public static IQueryable <T> Including <T>(this IQueryable <T> queryable, IncludingQuery <T> includingQuery) where T : class { return(includingQuery == null ? queryable : includingQuery.Columns.Aggregate(queryable, (x, y) => x.IncludeOptimized(y))); }
public async Task <TEntity> FindAsync( Expression <Func <TEntity, bool> > predicate, IncludingQuery <TEntity> includingQuery = null, CancellationToken cancellationToken = default) { return(await Queryable(predicate, includingQuery).SingleOrDefaultAsync(cancellationToken)); }
private IQueryable <TEntity> Queryable( Expression <Func <TEntity, bool> > predicate, IncludingQuery <TEntity> includingQuery = null, OrderingQuery <TEntity> orderingQuery = null, PagingQuery pagingQuery = null) { return(DbSet.Where(predicate).Including(includingQuery).Ordering(orderingQuery).Paging(pagingQuery)); }
public async Task <IReadOnlyList <TEntity> > GetAsync( Expression <Func <TEntity, bool> > predicate, IncludingQuery <TEntity> includingQuery = null, OrderingQuery <TEntity> orderingQuery = null, PagingQuery pagingQuery = null, CancellationToken cancellationToken = default) { return(await Queryable(predicate, includingQuery, orderingQuery, pagingQuery) .ToListAsync(cancellationToken)); }