40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Logging;
|
|
using PARR.DAL.Context;
|
|
using PARR.DAL.Models.AIHIT;
|
|
using PARR.DAL.Services.Abstracts;
|
|
using PARR.DAL.Services.Interfaces.AIHIT;
|
|
|
|
namespace PARR.DAL.Services.Implementations.AIHIT
|
|
{
|
|
internal class RawDataEKService : BaseService<RawDataEK>, IRawDataEKService
|
|
{
|
|
private readonly DataContext dataContext;
|
|
private readonly ILogger<RawDataEKService> logger;
|
|
|
|
public RawDataEKService(DataContext dataContext, ILogger<RawDataEKService> logger) : base(logger)
|
|
{
|
|
this.dataContext = dataContext;
|
|
this.logger = logger;
|
|
}
|
|
|
|
|
|
public void DeleteAll()
|
|
{
|
|
var startCount = EntitySet.Count();
|
|
if (startCount > 0)
|
|
{
|
|
EntitiContext.RawDataEKs.RemoveRange(EntitySet);
|
|
logger.LogInformation($"Из таблицы RawDataEK удалено {startCount} записей");
|
|
EntitiContext.SaveChanges();
|
|
}
|
|
}
|
|
|
|
|
|
protected override DbSet<RawDataEK> EntitySet => dataContext.RawDataEKs;
|
|
|
|
protected override DataContext EntitiContext => dataContext;
|
|
|
|
}
|
|
}
|