mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 01:54:00 +00:00
18 lines
461 B
C#
18 lines
461 B
C#
using System.Data.Common;
|
|
using Infrastructure.Repository.Sql;
|
|
|
|
namespace Infrastructure.Repository;
|
|
|
|
public abstract class Repository<T>(ISqlConnectionFactory connectionFactory)
|
|
where T : class
|
|
{
|
|
protected async Task<DbConnection> CreateConnection()
|
|
{
|
|
var connection = connectionFactory.CreateConnection();
|
|
await connection.OpenAsync();
|
|
return connection;
|
|
}
|
|
|
|
protected abstract T MapToEntity(DbDataReader reader);
|
|
}
|