Modernize and Dockerize server
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System.Data.Common;
|
||||
using CPATapi.Server.Interfaces;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace CPATapi.Server.Repository;
|
||||
|
||||
public class Repository: IRepository
|
||||
{
|
||||
private readonly IConfiguration _config;
|
||||
|
||||
protected Repository(IConfiguration config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
protected async Task<DbConnection> OpenAsync(string name)
|
||||
{
|
||||
var db = new SqlConnection(_config.GetConnectionString(name));
|
||||
await db.OpenAsync();
|
||||
return db;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user