private IQueryable <TEntity> BuildGetQuery(ISpecification <TEntity> spec) { if (spec == null) { throw new ArgumentNullException(nameof(spec)); } var query = DbContext.Set <TEntity>().AsQueryable(); query = spec.AddPredicates(query); query = spec.AddSorting(query); query = spec.AddEagerFetching(query); return(query); }