Completo move directory
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EgwCoreLib.Lux.Data
|
||||
{
|
||||
public class DbConfig
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static string DATABASE_NAME = "LUX";
|
||||
|
||||
public static int DATABASE_PROCESS_TIMEOUT = 5;
|
||||
public static string DATABASE_PWD = "viadante16";
|
||||
|
||||
// Database config
|
||||
public static string DATABASE_SERV = "127.0.0.1";
|
||||
|
||||
public static string DATABASE_USER = "Lux_User";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string per azioni amministrative
|
||||
/// </summary>
|
||||
public static string ADMIN_CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// DB Connection string
|
||||
/// </summary>
|
||||
public static string CONNECTION_STRING { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static bool CheckUser(string nKey, string sKey)
|
||||
{
|
||||
// esecuzione script di install locale
|
||||
return DbAdmin.checkCreateUser(DATABASE_USER, DATABASE_PWD);
|
||||
}
|
||||
|
||||
#if false
|
||||
public static bool ExecMigrationIdentity()
|
||||
{
|
||||
Log.Info($"ExecMigrationIdentity: Start");
|
||||
// esecuzione migrazione
|
||||
var migrateTask = Task.Run(async () => await DbAdmin.migrateDbIdentity());
|
||||
migrateTask.Wait();
|
||||
Log.Info($"ExecMigrationIdentity: Completed");
|
||||
return migrateTask.Result;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool ExecMigrationMain()
|
||||
{
|
||||
Log.Info($"ExecMigrationMain: Start");
|
||||
// esecuzione migrazione
|
||||
var migrateTask = Task.Run(async () => await DbAdmin.migrateDbMain());
|
||||
migrateTask.Wait();
|
||||
Log.Info($"ExecMigrationMain: Completed");
|
||||
return migrateTask.Result;
|
||||
}
|
||||
|
||||
public static void InitDb(string server, string nKey, string sKey)
|
||||
{
|
||||
DATABASE_SERV = server;
|
||||
DATABASE_NAME = $"Lux_{nKey}";
|
||||
DATABASE_USER = $"user_{nKey}";
|
||||
DATABASE_PWD = $"pwd_{sKey}";
|
||||
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None";
|
||||
// stringa admin con utente root egalware...
|
||||
ADMIN_CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database=mysql;uid=root;pwd=Egalware_24068!;sslmode=None";
|
||||
}
|
||||
|
||||
public static ServerVersion MysqlServerVersion(string connString)
|
||||
{
|
||||
ServerVersion serverVersion = ServerVersion.AutoDetect(connString);
|
||||
return serverVersion;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user