23 lines
750 B
C#
23 lines
750 B
C#
using Brizco.Repository.Repositories.UnitOfWork;
|
|
|
|
namespace Brizco.Repository.Repositories.Base;
|
|
public class RepositoryWrapper : IRepositoryWrapper
|
|
{
|
|
private readonly ApplicationContext _context;
|
|
private readonly IUnitOfWork _unitOfWork;
|
|
public RepositoryWrapper(ApplicationContext context)
|
|
{
|
|
_context = context;
|
|
_unitOfWork = new UnitOfWork.UnitOfWork(_context);
|
|
}
|
|
|
|
public IBaseRepository<T> SetRepository<T>() where T : ApiEntity => new BaseRepository<T>(_context);
|
|
|
|
public async System.Threading.Tasks.Task SaveChangesAsync(CancellationToken cancellationToken = default) => await _unitOfWork.SaveChangesAsync(cancellationToken);
|
|
|
|
public void Dispose()
|
|
{
|
|
_context?.Dispose();
|
|
}
|
|
}
|