0

我有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;`

异常消息是:

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

4

1 回答 1

0

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

你的意思是这样的吗?

var query = from s in DB.Sales
           where ...
           select new VendorLocation
           {
              ....
           };`
于 2013-02-18T04:26:29.333 回答