我有一个c#class
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;`
异常消息是:
无法处理类型'匿名类型,因为它没有已知的映射到值层
答案 0 :(得分:0)
当前状态为空时,如何从lstVendorLocation
获取商品?
你的意思是这样吗?
var query = from s in DB.Sales
where ...
select new VendorLocation
{
....
};`