我有這樣的LINQ查詢如何在Linq查詢中使用我的模型屬性?
var sales=db.Customers
.GroupBy
.Select(c=> new MyModel
{
count1=c.where(someCondition).Count(),
count2=c.where(otherCondition).Count(),
finalCount=count2-count1
});
是可能的LINQ? 我該如何解決這樣的問題?
您必須提供的GroupBy子句。 – HimBromBeere
你還沒有提到你的問題 –
@HimBromBeere他沒有,但這個問題並不重要:它是關於'Select'子句的。 –