EF-Core LINQ JOIN with include()

c# entity-framework-core linq

Question

Question: Is the above possible in EF-Core 1.1? I'm trying the following but VS2015 complaining on line Select new TestViewModel{...} with the error: name Select does not exist in the current context. If the above is not possible what's a workaround while sill using include(...)? Note: Customers is joined to Addresses and Orders table

var qry = from c in _context.Customers.Include(t => t.Addresses).Where(c => c.Region== "NW").OrderBy(c => c.Name)
 join ord in _context.Orders  on c.CustomerID equals ord.CustomerID
Select new TestViewModel
{
   CustName = c.Name,
   CustRegion  = c.Region,
   OrderType = ord.Type,
   ....
};
1
0
6/2/2017 3:41:39 PM

Accepted Answer

select is a keyword, and keywords are case-sensitive. Just like you cannot declare class Public Static - you cannot use Select.

2
6/2/2017 4:44:25 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow