protected IQueryable <TEntity> CreateQuery(IEntityIncludePaths <TEntity> includePaths) { var query = uow.DbContext.Set <TEntity>().AsQueryable(); if (includePaths is not null && includePaths.Any()) { query = includePaths.Distinct().Aggregate(query, (query, path) => query.Include(path)); } return(query); }
public virtual Task <IEnumerable <TEntity> > FindAsync(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths, CancellationToken cancellationToken = default) { return(Task.FromResult(Find(filter, paginator, includePaths))); }
public virtual IEnumerable <TEntity> Find(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths) { return(Find(filter, paginator)); }
public virtual async Task <IEnumerable <TEntity> > FindAsync(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths, CancellationToken cancellationToken = default) { return(await CreateQuery(includePaths).Filter(filter).Paginate(paginator).ToListAsync(cancellationToken).ConfigureAwait(false)); }
public virtual IEnumerable <TEntity> Find(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths) { return(CreateQuery(includePaths).Filter(filter).Paginate(paginator).ToList()); }