檢索相關數據,我有以下:LINQ無法從實體框架
db.Products.Where(p=>p.Sectors.Where(s=>s.website_id == websiteObj.website_id)).Count();
websiteObj不爲空,並且具有有效數據。產品和部門之間存在多對多的關係。此外,行業和網站之間還有一對多的關係。我沒有直接訪問網站上的產品,我不得不通過網站相關部門。
不管怎麼說,這個例子的工作原理: db.Sectors.Where(p=>p.website_id == websiteObj.website_id)).Count();
但問題是,第一個LINQ查詢給我下面的錯誤: Delegate 'System.Func<BusinessObjects.Product,int,bool>' does not take 1 arguments.
Cannot convert lambda expression to type 'string' because it is not a delegate type.
和幾個其他錯誤。
無論如何,我做錯了什麼?這是我第一次嘗試LINQ。 在此先感謝。
什麼結果,你想要得到的? –