收集财产的数量

时间:2015-06-23 20:15:36

标签: c# linq

我正在尝试使用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() 它产生相同的错误

0 个答案:

没有答案