我有以下c#语句,它通过EF生成了我想要的内容,但对如何使用查询语法编写此语句感到好奇:
var dealers = this.Dealers
.SelectMany (d => d.Brands, (d, col) => new { Name = d.Name, Brand = col.Name, StatusId = d.StatusId })
.Where (d => d.StatusId == 1);
最佳答案
var dealers = from d in Dealers
from col in d.Brands
where d.StatusId == 1
select new { Name = d.Name,
Brand = col.Name,
StatusId = d.StatusId };
关于c# - 如何使用多对多联接表以C#查询语法执行SelectMany?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7662913/