2024-10-31 17:02:48 +05:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
|
using Persistence.Models;
|
2024-10-31 15:01:12 +05:00
|
|
|
|
|
|
|
|
|
namespace Persistence.Repositories;
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public abstract class AbstractChangeLogRepository<TEntity, TRequest, TDto> : IChangeLogRepository<TDto, TRequest>
|
|
|
|
|
where TDto : class, new()
|
|
|
|
|
where TEntity : class, IChangeLogAbstract
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
2024-10-31 17:02:48 +05:00
|
|
|
|
private readonly DbContext dbContext;
|
|
|
|
|
|
|
|
|
|
protected AbstractChangeLogRepository(DbContext dbContext)
|
|
|
|
|
{
|
|
|
|
|
this.dbContext = dbContext;
|
|
|
|
|
}
|
2024-10-31 15:01:12 +05:00
|
|
|
|
public Task<int> Clear(int idUser, TRequest request, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<DateOnly>> GetDatesChange(TRequest request, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<IEnumerable<TDto>> GetGtDate(DateTimeOffset date, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
2024-10-31 17:02:48 +05:00
|
|
|
|
this.dbContext.Set<TEntity>();
|
|
|
|
|
var db = GetDataBase();
|
|
|
|
|
using var transaction = db.BeginTransaction();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//var result = await InsertRangeWithoutTransaction(idUser, dtos, token);
|
|
|
|
|
//await transaction.CommitAsync(token);
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//await transaction.RollbackAsync(token);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
2024-10-31 15:01:12 +05:00
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
protected abstract DatabaseFacade GetDataBase();
|
|
|
|
|
|
2024-10-31 15:01:12 +05:00
|
|
|
|
public Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<int> UpdateOrInsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<int> UpdateRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-31 17:02:48 +05:00
|
|
|
|
public Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogForDate(TRequest request, DateOnly? date, CancellationToken token)
|
2024-10-31 15:01:12 +05:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|