我正在尝试使用linq计算集合属性。我试过的是产生了这个错误。
{"The specified type member 'Partners' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."}
var Collection = new ObservableCollection<Projects>
(from item in ctx.Projects
select new Project
{
ProjectName = item.ProjectName,
Partners = item.Partners.Count()
})
我也试过了
Partners = item.Partners.Select(x => x.Id).Count()
它产生相同的错误