Refactor MSSQLServer to use IConfiguration for connection
Replaced LogConfig and direct connection string injection with IConfiguration. Connection string is now retrieved from configuration using the "Default" key. Removed LogConfig dependency and related code.
This commit is contained in:
@@ -1,19 +1,12 @@
|
||||
using System.Data;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using DigitalData.Modules.Logging;
|
||||
|
||||
namespace DigitalData.Modules.Database;
|
||||
|
||||
public class MSSQLServer
|
||||
public class MSSQLServer(IConfiguration configuration)
|
||||
{
|
||||
private readonly LogConfig _logConfig;
|
||||
private readonly string _connectionString;
|
||||
|
||||
public MSSQLServer(LogConfig logConfig, string connectionString)
|
||||
{
|
||||
_logConfig = logConfig;
|
||||
_connectionString = connectionString;
|
||||
}
|
||||
private readonly string _connectionString = configuration.GetConnectionString("Default")
|
||||
?? throw new InvalidOperationException("Connection string 'Default' not found.");
|
||||
|
||||
public static string DecryptConnectionString(string connectionString) => connectionString;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user