这是我的语句
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.IQueryable
1[[<>f__AnonymousType0
2[[Data.Rad.EntityClasses.]AxsEntity,数据。Rad, Version=1.0.4125.30654, Culture=neutral, PublicKeyToken=null],[Data.Rad.EntityClasses.]AccountEntity,数据。Rad, Version=1.0.4125.30654, Culture=neutral, PublicKeyToken=null]], Model。Rad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'不能以任何方式转换为实体类型。你是否对group by子句使用了let语句?
有什么方法可以做到这一点吗?如果我在内存中分组,它会杀死我的电脑
不能使用groupby查询来获取实体,因为groupby查询的是组数据,而实体是直接从表中获取的。