方法无法转换为商店表达式我看到这个代码使用LINQ to SQL,但是当我使用Entity Framework时,它会抛出此错误:LINQ to Entities无法识别方法'System.Linq.IQueryable'1 [MyProject.Models.CommunityFeatures] GetCommunityFeatures()'方法,并且此方法无法转换为商店表达式。存储库代码是这样的:public IQueryable<Models.Estate> GetEstates(){
return from e in entity.Estates
let AllCommFeat = GetCommunityFeatures()
let AllHomeFeat = GetHomeFeatures()
select new Models.Estate
{
EstateId = e.EstateId,
AllHomeFeatures = new LazyList<HomeFeatures>(AllHomeFeat),
AllCommunityFeatures = new LazyList<CommunityFeatures>(AllCommFeat)
};}public IQueryable<Models.CommunityFeatures> GetCommunityFeatures(){
return from f in entity.CommunityFeatures
select new CommunityFeatures
{
Name = f.CommunityFeature1,
CommunityFeatureId = f.CommunityFeatureId
};}public IQueryable<Models.HomeFeatures> GetHomeFeatures(){
return from f in entity.HomeFeatures
select new HomeFeatures()
{
Name = f.HomeFeature1,
HomeFeatureId = f.HomeFeatureId
};}LazyList是一个扩展IQueryable功能的List。有人能解释为什么会出现这种错误吗
1 回答
- 1 回答
- 0 关注
- 336 浏览
添加回答
举报
0/150
提交
取消