Review LAND x preparare nuovi installers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using NLog;
|
||||
using System;
|
||||
@@ -9,14 +10,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class AppAuthController : IDisposable
|
||||
public class AppAuthController
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
dbCtx = new AppAuthContext(configuration);
|
||||
|
||||
Log.Info("Avviata classe AppAuthController");
|
||||
}
|
||||
|
||||
@@ -116,11 +117,6 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco completo permessi2funzione
|
||||
@@ -193,33 +189,7 @@ namespace MP.AppAuth.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new AppAuthContext(_configuration);
|
||||
Log.Info("Effettuato reset AppAuthController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x gestione Update
|
||||
@@ -259,7 +229,6 @@ namespace MP.AppAuth.Controllers
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
Reference in New Issue
Block a user