繁体   English   中英

带有include()的EF核心LINQ JOIN

[英]EF-Core LINQ JOIN with include()

问题 :在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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM