SPEC:
- aggiunta pagina operatori - completato fix
This commit is contained in:
@@ -15,21 +15,15 @@ namespace MP.Data.Repository.FluxLog
|
||||
{
|
||||
public class FluxLogRepository : IFluxLogRepository
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
private static NLog.Logger Log = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public FluxLogRepository(IConfiguration configuration)
|
||||
public FluxLogRepository(IConfiguration configuration, IDbContextFactory<MoonPro_FluxContext> ctxFactoryFL)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_ctxFactoryFL = ctxFactoryFL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -60,7 +54,7 @@ namespace MP.Data.Repository.FluxLog
|
||||
var pIdxMacchina = new SqlParameter("@IdxMacchina", idxMaccSel);
|
||||
var pOnlyTest = new SqlParameter("@OnlyTest", false);
|
||||
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
foreach (var item in fluxList)
|
||||
{
|
||||
Log.Info($"FluxLogDataReduxAsync | Flux: {item}");
|
||||
@@ -149,7 +143,7 @@ namespace MP.Data.Repository.FluxLog
|
||||
/// <inheritdoc />
|
||||
public async Task<List<FluxLogModel>> FluxLogGetLastFiltAsync(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
return await dbCtx
|
||||
.DbSetFluxLog
|
||||
.AsNoTracking()
|
||||
@@ -162,7 +156,7 @@ namespace MP.Data.Repository.FluxLog
|
||||
/// <inheritdoc />
|
||||
public async Task<List<ParetoFluxLogDTO>> FluxLogParetoAsync(string idxMacchina, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
await using var dbCtx = new MoonPro_FluxContext(_configuration);
|
||||
await using var dbCtx = await _ctxFactoryFL.CreateDbContextAsync();
|
||||
return await dbCtx
|
||||
.DbSetFluxLog
|
||||
.Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo))
|
||||
@@ -173,6 +167,19 @@ namespace MP.Data.Repository.FluxLog
|
||||
.ToListAsync() ?? new();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected readonly IDbContextFactory<MoonPro_FluxContext> _ctxFactoryFL;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = NLog.LogManager.GetCurrentClassLogger();
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user