[英]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.