Completato fix SPEC, ok x MON, altri da verificare/sistemare
This commit is contained in:
@@ -20,7 +20,7 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
_configuration = configuration;
|
||||
string connStr = _configuration.GetConnectionString("MP.Land");
|
||||
if(string.IsNullOrEmpty(connStr))
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
connStr = _configuration.GetConnectionString("MP.Data");
|
||||
}
|
||||
@@ -143,7 +143,8 @@ namespace MP.Data.Controllers
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_configuration = null;
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -262,11 +263,28 @@ namespace MP.Data.Controllers
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
// Free managed resources here
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private DbContextOptions<MoonProContext> options;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly DbContextOptions<MoonProContext> options;
|
||||
private bool _disposed = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using DnsClient.Protocol;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DbModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using static MP.Core.Objects.Enums;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
@@ -19,6 +15,10 @@ namespace MP.Data.Controllers
|
||||
public MpVocController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
string connStr = _configuration.GetConnectionString("MP.Voc");
|
||||
options = new DbContextOptionsBuilder<MoonPro_VocContext>()
|
||||
.UseSqlServer(connStr)
|
||||
.Options;
|
||||
Log.Info("Avviata classe MpVocController");
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace MP.Data.Controllers
|
||||
|
||||
#region Public Methods
|
||||
|
||||
private DbContextOptions<MoonPro_VocContext> options;
|
||||
/// <summary>
|
||||
/// Elenco da tabella Config
|
||||
/// </summary>
|
||||
@@ -33,15 +34,12 @@ namespace MP.Data.Controllers
|
||||
public List<ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<ConfigModel> dbResult = new List<ConfigModel>();
|
||||
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
using var dbCtx = new MoonPro_VocContext(options);
|
||||
return dbCtx
|
||||
.DbSetConfig
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -55,15 +53,12 @@ namespace MP.Data.Controllers
|
||||
public List<LingueModel> LingueGetAll()
|
||||
{
|
||||
List<LingueModel> dbResult = new List<LingueModel>();
|
||||
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetLilngue
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lingua)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
using var dbCtx = new MoonPro_VocContext(options);
|
||||
return dbCtx
|
||||
.DbSetLilngue
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lingua)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,15 +68,12 @@ namespace MP.Data.Controllers
|
||||
public List<VocabolarioModel> VocabolarioGetAll()
|
||||
{
|
||||
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
|
||||
using (var dbCtx = new MoonPro_VocContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
using var dbCtx = new MoonPro_VocContext(options);
|
||||
return dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
Reference in New Issue
Block a user