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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user