Initial code commit.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace Sufi.Demo.PeopleDirectory.Application.Contracts.Common
|
||||
{
|
||||
public interface IService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Sufi.Demo.PeopleDirectory.Application.Contracts.Services
|
||||
{
|
||||
public interface IAppCache
|
||||
{
|
||||
ValueTask<T> GetOrAddAsync<T>(string key, Func<CancellationToken, ValueTask<T>> factory,
|
||||
IEnumerable<string>? tags = null, TimeSpan? absoluteExpireTime = null);
|
||||
ValueTask RemoveAsync(string key);
|
||||
ValueTask RemoveByTagAsync(string tag);
|
||||
ValueTask ResetAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Sufi.Demo.PeopleDirectory.Application.Contracts.Common;
|
||||
|
||||
namespace Sufi.Demo.PeopleDirectory.Application.Contracts.Services
|
||||
{
|
||||
public interface ICurrentUserService : IService
|
||||
{
|
||||
string? UserId { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user