我有以下的EF表达:EF选择内选择
var complexes = db.ResidentialComplexes.AsNoTracking()
.Where(rc => rc.MasterEntity == entity)
.Select(rc => new CustomComplexObj()
{
ComplexId = rc.ComplexId,
Name = rc.Name,
Region = rc.Region,
Properties = rc.CurrentProperties.Select(p=> new CustomPropertyObj(){
Name = p.Name,
PropertyId = p.PropertyId
}).ToList()
}).ToList();
即时得到一个错误的设置时:
Properties = rc.CurrentProperties.Select(p=> new CustomPropertyObj(){
Name = p.Name,
PropertyId = p.PropertyId
}).ToList()
这是错误:
LINQ到实体不识别方法'System.Collections.Generic.List 1[CondoTrack.Model.Poco.CustomPropertyObj] ToList[CustomPropertyObj](System.Collections.Generic.IEnumerable
1 [CondoTrack.Model.Poco.CustomPropertyObj])''方法,并且此方法不能转换为sto重新表达。
关于如何获得所需结果的任何线索?
什么是错误? – CodingGorilla