Update Specification and other packages to latest version (#582)

* Updating repositories and specification version
Need to fix broken tests

* removing test that would just be testing mocked result now

* Refactored from IAsyncRepository and removed it.
Tests pass.

* Update packages
This commit is contained in:
Steve Smith
2021-10-25 15:13:02 -04:00
committed by GitHub
parent fee2bbce3d
commit 8a45a2c858
39 changed files with 281 additions and 289 deletions

View File

@@ -1,21 +0,0 @@
using Ardalis.Specification;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IAsyncRepository<T> where T : BaseEntity, IAggregateRoot
{
Task<T> GetByIdAsync(int id, CancellationToken cancellationToken = default);
Task<IReadOnlyList<T>> ListAllAsync(CancellationToken cancellationToken = default);
Task<IReadOnlyList<T>> ListAsync(ISpecification<T> spec, CancellationToken cancellationToken = default);
Task<T> AddAsync(T entity, CancellationToken cancellationToken = default);
Task UpdateAsync(T entity, CancellationToken cancellationToken = default);
Task DeleteAsync(T entity, CancellationToken cancellationToken = default);
Task<int> CountAsync(ISpecification<T> spec, CancellationToken cancellationToken = default);
Task<T> FirstAsync(ISpecification<T> spec, CancellationToken cancellationToken = default);
Task<T> FirstOrDefaultAsync(ISpecification<T> spec, CancellationToken cancellationToken = default);
}
}

View File

@@ -4,8 +4,8 @@ using System.Threading.Tasks;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IOrderRepository : IAsyncRepository<Order>
{
Task<Order> GetByIdWithItemsAsync(int id);
}
//public interface IOrderRepository : IAsyncRepository<Order>
//{
// Task<Order> GetByIdWithItemsAsync(int id);
//}
}

View File

@@ -0,0 +1,8 @@
using Ardalis.Specification;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IReadRepository<T> : IReadRepositoryBase<T> where T : class, IAggregateRoot
{
}
}

View File

@@ -0,0 +1,8 @@
using Ardalis.Specification;
namespace Microsoft.eShopWeb.ApplicationCore.Interfaces
{
public interface IRepository<T> : IRepositoryBase<T> where T : class, IAggregateRoot
{
}
}