问题描述
|
这是我的陈述
private IEnumerable<IGrouping<AccountEntity,AxsEntity>> GetAxsEntitiesForInvoicing(IDataAccessAdapter adapter)
{
var MetaData = new LinqMetaData(adapter);
var query = from axsEntity in MetaData.Axs
join accountEntity in MetaData.Account on axsEntity.AccountId equals accountEntity.AccountId
where
(axsEntity.DateDeleted.HasValue? axsEntity.DateDeleted.Value<DateTime.Now:true) &&
(axsEntity.DateEnd == null || axsEntity.DateEnd > axsEntity.Daterenewal) &&
axsEntity.Daterenewal < renewalDate // NONE INCLUSIVE DATE
group axsEntity by accountEntity into axsCol
select axsCol;
return query;
一旦我尝试将其转换为.ToList(),它将引发错误。
类型\'System.Linq.IQueryable1[[<>f__AnonymousType0
2[[Data.Rad.EntityClasses.AxsEntity,Data.Rad,Version = 1.0.4125.30654,Culture = neutral,PublicKeyToken = null],[Data.Rad.EntityClasses.AccountEntity,Data.Rad ,版本= 1.0.4125.30654,文化=中性,PublicKeyToken = null]],模型.Rad,版本= 1.0.0.0,文化=中性,PublicKeyToken = null]]''不能在任何情况下转换为实体类型道路。您是否在group by子句上使用了let语句?
反正有做到这一点。如果我按内存分组,它将杀死我的计算机。解决方法
您不能使用groupby查询来获取实体,因为groupby查询会对数据进行分组,并且实体是直接从表中获取的。