我試圖複製在LINQ下面的SQL查詢:的LINQ和的EntityFramework,ISNULL和獲取單個值的加入
Select
l.*,
ISNULL(i.InterestPercentage,0)
as InterestPercentage
FROM properties l
LEFT JOIN interest i on i.ListingKey = l.ListingKey
Where i.userId = {0}
我真的沒有太多去的那一刻:
var results = from l in context.properties
join s in context.interest on l.ListingKey equals s.ListingKey
where s.userId == "";
這將返回我一個完整的加盟,但我想用一個單一的附加價值迴歸的屬性外,InterestPercentage
。我想我可能需要創建一個新的對象,它是所有具有InterestPercentage屬性的屬性列。然後添加select new MyObject { tons of property setters }
。
此外,雖然,我試圖通過Odata公開這個,我會失去這個可查詢的能力嗎?
結束了這樣做。謝謝 – Prescott 2013-05-07 15:40:03