c# - Rewrite sql sub to linq query -


i'm not sure begin on how convert query linq.

started reading here , looked few youtube videos not sure

here query:

select  o.replacementitemid, o.itemstatus, o.description, i.itemwarrantyid, o.id originalitemid (     select          id,         itemstatus,         description,         itemwarrantyid,         replacementitemid     item     itemstatus = 'obso'    )o inner join item    on o.replacementitemid = i.id 

christos provided method chaining example, here's query syntax example:

var results = o in (from x in item                          x.itemstatus == "obso"                          select new                           {                             x.id,                            x.itemstatus,                            x.description,                            x.itemwarrantyid,                            x.replacementitemid                          })              join in item                on o.replacementitemid equals i.itemid              select new               {                o.replacementitemid,                o.itemstatus,                o.description,                i.itemwarrantyid,                originalitemid = o.id              }; 

i'm partial query syntax weird stuff this, because it's typically easier read. :)


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -