繁体   English   中英

对象与实体框架表的联接

[英]Object joining with entity framework table

我有AC#班

public class VendorLocation
{
    public string VendorCode { get; set; }
    public string Location { get; set; }
}

和一个清单

var lstVendorLocation = new List<VendorLocation>();

以下LINQ查询被编译并在运行时引发异常:

var query = from s in DB.Sales
           where lstVendorLocation.Any(vendorLoc => s.VendorCode.Equals(lstVendorLoc.VendorCode) && s.Location.Equals(lstVendorLoc.Location)) 
           select s;`

异常消息是:

无法处理类型'匿名类型,因为它没有到值层的已知映射

当前状态为空时,如何从lstVendorLocation获取项目?

你是这个意思吗

var query = from s in DB.Sales
           where ...
           select new VendorLocation
           {
              ....
           };`

暂无
暂无

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

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