簡體   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