81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Persistence.Models;
|
|
|
|
namespace Persistence.Repositories;
|
|
public abstract class AbstractChangeLogRepository<TEntity, TRequest, TDto> : IChangeLogRepository<TDto, TRequest>
|
|
where TDto : class, new()
|
|
where TEntity : class, IChangeLogAbstract
|
|
{
|
|
private readonly DbContext dbContext;
|
|
|
|
protected AbstractChangeLogRepository(DbContext dbContext)
|
|
{
|
|
this.dbContext = dbContext;
|
|
}
|
|
public Task<int> Clear(int idUser, TRequest request, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<int> ClearAndInsertRange(int idUser, TRequest request, IEnumerable<TDto> dtos, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<IEnumerable<TDto>> GetCurrent(TRequest request, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<IEnumerable<DateOnly>> GetDatesChange(TRequest request, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<IEnumerable<TDto>> GetGtDate(DateTimeOffset date, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<int> InsertRange(int idUser, IEnumerable<TDto> dtos, CancellationToken token)
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
|
|
protected abstract DatabaseFacade GetDataBase();
|
|
|
|
public Task<int> MarkAsDeleted(int idUser, IEnumerable<int> ids, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
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)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public Task<IEnumerable<ChangeLogDto<TDto>>> GetChangeLogForDate(TRequest request, DateOnly? date, CancellationToken token)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|