[英]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
已加入“ Addresses
和Orders
表
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.