我尝试通过以下链接在Select()中实现ThenInclude: https://github.com/beyourmarket/beyourmarket/blob/master/src/Frameworks/Repository.Pattern.Ef6/Repository.cs
之前:
internal IQueryable<TEntity> Select(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
List<Expression<Func<TEntity, object>>> includes = null,
int? page = null,
int? pageSize = null)
{
IQueryable<TEntity> query = this._dbSet;
if (includes != null)
{
query = includes.Aggregate(query, (current, include) => current.Include(include));
}
之后:
internal IQueryable<TEntity> Select(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
List<Expression<Func<TEntity, object>>> includes = null,
Expression<Func<**???**>> thenInclude = null,
int? page = null,
int? pageSize = null)
{
IQueryable<TEntity> query = this._dbSet;
if (includes != null)
{
if (thenInclude != null)
{
query = includes.Aggregate(query, (current, include) => current.Include(include).ThenInclude(thenInclude));
}
else
{
query = includes.Aggregate(query, (current, include) => current.Include(include));
}
}
请帮助我看看并给我一些建议。 那样的方式可能与否。如果是,那么上面的thenInclude(Expression ??? >> thenInclude = null,)的类型是什么,