Paging infrastructure implemented through specifications. (#151)

* Paging criterias added in BaseSpecification. New paginated specification added (CatalogFilterPaginatedSpecification) . EFRepository cleaned up and paging implementation added. Usage of the new paging infrastructure in CatalogService (Web and WebRazor).

* Use IReadOnlyList<T> instead of List<T> as return type from repositories.

* - Ordering possibility added in the specification.
- Evaluation of the specification placed in separate class.
This commit is contained in:
Fati Iseni
2018-11-09 07:46:58 +01:00
committed by Steve Smith
parent 156d5c6b25
commit 04530db118
9 changed files with 114 additions and 46 deletions

View File

@@ -7,10 +7,11 @@ namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
public interface IAsyncRepository<T> where T : BaseEntity
{
Task<T> GetByIdAsync(int id);
Task<List<T>> ListAllAsync();
Task<List<T>> ListAsync(ISpecification<T> spec);
Task<IReadOnlyList<T>> ListAllAsync();
Task<IReadOnlyList<T>> ListAsync(ISpecification<T> spec);
Task<T> AddAsync(T entity);
Task UpdateAsync(T entity);
Task DeleteAsync(T entity);
Task<int> CountAsync(ISpecification<T> spec);
}
}

View File

@@ -12,5 +12,6 @@ namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
T Add(T entity);
void Update(T entity);
void Delete(T entity);
int Count(ISpecification<T> spec);
}
}

View File

@@ -9,5 +9,11 @@ namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
Expression<Func<T, bool>> Criteria { get; }
List<Expression<Func<T, object>>> Includes { get; }
List<string> IncludeStrings { get; }
Expression<Func<T, object>> OrderBy { get; }
Expression<Func<T, object>> OrderByDescending { get; }
int Take { get; }
int Skip { get; }
bool isPagingEnabled { get;}
}
}