FixTaskMan module
- LAND - STATS
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
<div class="my-component">
|
||||
This component is defined in the <strong>MP.TaskMan</strong> library.
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
.my-component {
|
||||
border: 2px dashed red;
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
background-image: url('background.png');
|
||||
}
|
||||
@@ -31,8 +31,9 @@ namespace MP.TaskMan.Services
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
redisDb = redisConn.GetDatabase();
|
||||
|
||||
// conf DB
|
||||
ConnStr = _configuration.GetConnectionString("MP.All");
|
||||
// ConnString del DB x gestione task
|
||||
string taskDbCS = _configuration.GetValue<string>("SpecialConf:TaskManConn");
|
||||
ConnStr = _configuration.GetConnectionString(taskDbCS);
|
||||
if (string.IsNullOrEmpty(ConnStr))
|
||||
{
|
||||
Log.Error("ConnString empty!");
|
||||
@@ -44,7 +45,7 @@ namespace MP.TaskMan.Services
|
||||
sb.AppendLine($"TaskService | MpTaskController OK");
|
||||
Log.Info(sb.ToString());
|
||||
// sistemo i parametri x redHas...
|
||||
CodModulo = _configuration.GetValue<string>("ServerConf:CodModulo");
|
||||
CodModulo = _configuration.GetValue<string>("SpecialConf:CodModulo");
|
||||
var cstringArray = ConnStr.Split(";");
|
||||
foreach (var item in cstringArray)
|
||||
{
|
||||
|
||||
+44
-24
@@ -58,33 +58,53 @@ namespace MP.TaskMan
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("MP.TaskMan");
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("MP.All");
|
||||
}
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("MP.Data");
|
||||
}
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("MP.Mon");
|
||||
}
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("MP.STATS");
|
||||
}
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
connString = _configuration.GetConnectionString("MP.Land");
|
||||
}
|
||||
|
||||
// recupero la connString tra i candidati...
|
||||
string connString = ConnStringGetFirst();
|
||||
// avvio con stringa connessione trovata
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
//optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
|
||||
//optionsBuilder.UseSqlServer("Server=SQL2016DEV; Database=MoonPro; Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca la connString del DB usato da stats basandosi sull'elenco dei nomi delle chaivi da cercare, dalle + specifiche alle più generiche
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string ConnStringGetFirst()
|
||||
{
|
||||
// in primis cerco se c'è la conf di quale connString usare per il programma specifico
|
||||
string scTaskConn = _configuration.GetValue<string>("SpecialConf:TaskManConn");
|
||||
string connString = _configuration.GetConnectionString(scTaskConn);
|
||||
|
||||
// altrimenti ciclo tra le conf alternative standard la + specifica
|
||||
if (string.IsNullOrEmpty(connString))
|
||||
{
|
||||
foreach (var keyName in ConnStringList)
|
||||
{
|
||||
connString = _configuration.GetConnectionString(keyName);
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return connString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei nomi delle connString da provare x il DB di riferimento qualora non specificato in conf
|
||||
/// </summary>
|
||||
protected List<string> ConnStringList { get; set; } = new List<string>()
|
||||
{
|
||||
"MP.TaskMan",
|
||||
"MP.STATS",
|
||||
"MP.SPEC",
|
||||
"MP.Land",
|
||||
"MP.Mon",
|
||||
"MP.Data",
|
||||
"MP.All"
|
||||
};
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
@@ -107,7 +127,7 @@ namespace MP.TaskMan
|
||||
.HasColumnName("valoreStd")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
});
|
||||
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user