Align .editorconfig files

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

Injected AppSettings instead of using GetEnvironmentVariable at Services level

Get ready to use VSCode IDE
This commit is contained in:
2024-12-03 12:23:56 -07:00
parent 89790f4fc1
commit 538b1f817e
72 changed files with 3420 additions and 391 deletions

View File

@ -1,5 +1,7 @@
using System.Data;
using MesaFabApproval.Models;
using Microsoft.Data.SqlClient;
namespace MesaFabApproval.API.Services;
@ -11,12 +13,10 @@ public interface IDbConnectionService {
public class DbConnectionService : IDbConnectionService {
private readonly string _dbConnectionString;
public DbConnectionService() {
_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);
}
}
public IDbConnection GetConnection() =>
new SqlConnection(_dbConnectionString);
}