Created ExpiredOOOStatusWorker

This commit is contained in:
Chase Tucker
2024-03-25 12:22:26 -07:00
parent 27f78da969
commit 69fdd98ab3
46 changed files with 549 additions and 5118 deletions

View File

@ -0,0 +1,30 @@
using Microsoft.Data.SqlClient;
using Microsoft.Data.Sqlite;
using System.Data;
namespace FabApprovalWorkerService.Services;
public interface IDbConnectionService {
IDbConnection GetConnection();
}
public class DbConnectionService : IDbConnectionService {
private readonly string _envName;
private readonly string _dbConnectionString;
public DbConnectionService() {
_envName = Environment.GetEnvironmentVariable("FabApprovalEnvironmentName") ??
throw new ArgumentNullException("FabApprovalEnvironmentName environment variable not found");
_dbConnectionString = Environment.GetEnvironmentVariable("FabApprovalDbConnectionString") ??
throw new ArgumentNullException("FabApprovalDbConnectionString environment variable not found");
}
public IDbConnection GetConnection() {
if (_envName.ToLower().Equals("development")) {
return new SqliteConnection(_dbConnectionString);
} else {
return new SqlConnection(_dbConnectionString);
}
}
}