public BaseQuerySpecification( Expression <Func <TEntity, bool> > whereExpression, IIncludeSpecification <TEntity> includeSpecification, ISortOrderSpecification <TEntity> sortOrderSpecification, IPagingSpecification pagingSpecification) { WhereExpression = whereExpression; IncludeSpecification = includeSpecification; SortOrderSpecification = sortOrderSpecification; PagingSpecification = pagingSpecification; }
public async Task <TEntity> GetById(int id, IIncludeSpecification <TEntity> specification) { specification.ValidateNotNull(nameof(specification)); var queriable = ApplyIncludeSpecification(_dbSet, specification); var result = await queriable .FirstOrDefaultAsync(e => e.Id == id) .ConfigureAwait(false); return(result); }
private static IQueryable <TEntity> ApplyIncludeSpecification(IQueryable <TEntity> queriable, IIncludeSpecification <TEntity> includeSpecification) { return(includeSpecification.IncludeDelegate(queriable)); }