コード例 #1
0
        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);
        }
コード例 #2
0
 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)));
 }
コード例 #3
0
 public virtual IEnumerable <TEntity> Find(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths)
 {
     return(Find(filter, paginator));
 }
コード例 #4
0
 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));
 }
コード例 #5
0
 public virtual IEnumerable <TEntity> Find(IQueryableFilter <TEntity> filter, IQueryablePaginator <TEntity> paginator, IEntityIncludePaths <TEntity> includePaths)
 {
     return(CreateQuery(includePaths).Filter(filter).Paginate(paginator).ToList());
 }