Mike Phares 538b1f817e 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
2024-12-03 12:23:56 -07:00

22 lines
534 B
C#

using System.Data;
using MesaFabApproval.Models;
using Microsoft.Data.SqlClient;
namespace MesaFabApproval.API.Services;
public interface IDbConnectionService {
IDbConnection GetConnection();
}
public class DbConnectionService : IDbConnectionService {
private readonly string _dbConnectionString;
public DbConnectionService(AppSettings appSettings) {
_dbConnectionString = appSettings.DbConnectionString;
}
public IDbConnection GetConnection() =>
new SqlConnection(_dbConnectionString);
}