This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
BirdsiteLIVE/src/DataAccessLayers/BirdsiteLive.DAL.Postgres/DataAccessLayers/Base/PostgresBase.cs
2022-12-30 15:49:39 -05:00

36 lines
901 B
C#

using BirdsiteLive.DAL.Postgres.Settings;
using BirdsiteLive.DAL.Models;
using Npgsql;
namespace BirdsiteLive.DAL.Postgres.DataAccessLayers.Base
{
public class PostgresBase
{
protected readonly PostgresSettings _settings;
protected NpgsqlDataSource _dataSource;
#region Ctor
protected PostgresBase(PostgresSettings settings)
{
_settings = settings;
var dataSourceBuilder = new NpgsqlDataSourceBuilder(settings.ConnString);
_dataSource = dataSourceBuilder.Build();
}
#endregion
protected NpgsqlDataSource DataSource
{
get
{
return _dataSource;
}
}
protected NpgsqlConnection Connection
{
get
{
return _dataSource.CreateConnection();
}
}
}
}