Initial code commit.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Sufi.Demo.PeopleDirectory.Domain.Common;
|
||||
|
||||
namespace Sufi.Demo.PeopleDirectory.Application.Contracts.Repositories
|
||||
{
|
||||
public interface IAsyncRepository<T, in TId> where T : class, IEntity<TId>
|
||||
{
|
||||
IQueryable<T> Entities { get; }
|
||||
|
||||
Task<T?> GetByIdAsync(TId id);
|
||||
|
||||
Task<List<T>> GetAllAsync();
|
||||
|
||||
Task<List<T>> GetPagedResponseAsync(int pageNumber, int pageSize);
|
||||
|
||||
Task<T> AddAsync(T entity);
|
||||
|
||||
Task UpdateAsync(T entity);
|
||||
|
||||
Task DeleteAsync(T entity);
|
||||
Task<int> DeleteByIdAsync(TId id);
|
||||
|
||||
Task<int> CountAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Sufi.Demo.PeopleDirectory.Domain.Common;
|
||||
|
||||
namespace Sufi.Demo.PeopleDirectory.Application.Contracts.Repositories
|
||||
{
|
||||
public interface IUnitOfWork<TId> : IDisposable
|
||||
{
|
||||
IAsyncRepository<T, TId> Repository<T>() where T : AuditableEntity<TId>;
|
||||
|
||||
Task<int> Commit(CancellationToken cancellationToken);
|
||||
|
||||
Task<int> CommitAndRemoveCache(CancellationToken cancellationToken, params string[] cacheKeys);
|
||||
|
||||
Task Rollback();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user