Pull Request 33523 suggestions

Pull Request 33520 suggestions

Injected AppSettings instead of using GetEnvironmentVariable at Services level

When debugging only
app.Services.GetRequiredService<IPCRBService>();

Get ready to use VSCode IDE

Align .editorconfig files
This commit is contained in:
2024-12-03 10:48:07 -07:00
parent 08fcd985ea
commit 7be540964a
59 changed files with 2821 additions and 214 deletions

View File

@ -1,7 +1,8 @@
using Microsoft.Data.SqlClient;
using Microsoft.Data.Sqlite;
using System.Data;
using System.Data;
using FabApprovalWorkerService.Models;
using Microsoft.Data.SqlClient;
namespace FabApprovalWorkerService.Services;
@ -10,17 +11,13 @@ public interface IDbConnectionService {
}
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 DbConnectionService(AppSettings appSettings) {
_dbConnectionString = appSettings.DbConnectionString;
}
public IDbConnection GetConnection() {
return new SqlConnection(_dbConnectionString);
}
}
}