我正在使用实体框架6与LazyLoadEnabled = false
配置没有别的。我在我的项目中使用UnitOfwork存储库模式。 而且我有大约1,50,000条记录在一个外键关系约5个表的表中。现在,我的要求就是我要实现服务器端pagination.For,首先我查询这个表应用一些基本的过滤器后能得到确切的数(如isactive和用户创建的)象下面这样:OutOfMemory异常Where条款
public long Count(Func<TEntity,bool> where)
{
return DbSet.Where(where).Count();
}
然后我正在申请某些搜索字符串过滤器和包括像下面的一些外国文献:
public IQueryable<TEntity> GetWithInclude(Expression<Func<TEntity, bool>> predicate, params string[] include)
{
IQueryable<TEntity> query = this.DbSet;
query = include.Aggregate(query, (current, inc) => current.Include(inc));
return query.Where(predicate);
}
但在这两种方法中,我越来越OutOfMemory exception
,因为我已经使用Where
条款。请帮我摆脱这个问题。