帶有include()的EF-Core LINQ JOIN

c# entity-framework-core linq

問題 :EF-Core 1.1中是否可以實現上述功能?我正在嘗試以下但是VS2015抱怨Select new TestViewModel{...}並帶有錯誤: name Select does not exist in the current context 。如果以上是不可能的,那麼在使用include(...)情況下,什麼是變通方法? 注意Customers已加入“ AddressesOrders

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,
   ....
};

一般承認的答案

select是關鍵字,關鍵字區分大小寫。就像你不能聲明類Public Static - 你不能使用Select



Related

許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow