MRB webassembly
This commit is contained in:
22
MesaFabApproval.API/Services/DbConnectionService.cs
Normal file
22
MesaFabApproval.API/Services/DbConnectionService.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Data;
|
||||
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace MesaFabApproval.API.Services;
|
||||
|
||||
public interface IDbConnectionService {
|
||||
IDbConnection GetConnection();
|
||||
}
|
||||
|
||||
public class DbConnectionService : IDbConnectionService {
|
||||
private readonly string _dbConnectionString;
|
||||
|
||||
public DbConnectionService() {
|
||||
_dbConnectionString = Environment.GetEnvironmentVariable("FabApprovalDbConnectionString") ??
|
||||
throw new ArgumentNullException("FabApprovalDbConnectionString environment variable not found");
|
||||
}
|
||||
|
||||
public IDbConnection GetConnection() {
|
||||
return new SqlConnection(_dbConnectionString);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user