23-08-23
This commit is contained in:
33
EnvelopeGenerator.Web/Services/DatabaseService.cs
Normal file
33
EnvelopeGenerator.Web/Services/DatabaseService.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using DigitalData.Modules.Database;
|
||||
using DigitalData.Modules.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Services
|
||||
{
|
||||
public class DatabaseService
|
||||
{
|
||||
public MSSQLServer MSSQL { get; set; }
|
||||
|
||||
private readonly LogConfig _logConfig;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DatabaseService(LoggingService Logging, IConfiguration Config)
|
||||
{
|
||||
_logConfig = Logging.LogConfig;
|
||||
_logger = Logging.LogConfig.GetLogger();
|
||||
|
||||
_logger.Debug("Establishing MSSQL Database connection..");
|
||||
MSSQL = new MSSQLServer(_logConfig, Config["Config:ConnectionString"]);
|
||||
|
||||
if (MSSQL.DBInitialized == true)
|
||||
{
|
||||
_logger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Warn("Connection could not be established!");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user