0
我有一個C#類對象與實體框架表連接
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;`
例外信息是:
無法處理類型爲「匿名類型,因爲它沒有已知的映射值層
爲什麼你在標題中放置標籤C#並且沒有在標籤框中? – abatishchev 2013-02-18 04:22:55
'lstVendorLocation'的來源是什麼?如果可能的話,你應該嘗試使用它作爲原始的'IQueryable'。 – 2013-02-18 08:47:06