2022-06-29 19:46:41 -04:00
|
|
|
|
using Dapper;
|
2016-02-06 11:09:55 -05:00
|
|
|
|
|
2022-08-29 15:53:48 -04:00
|
|
|
|
namespace Bit.Infrastructure.Dapper.Repositories
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
public abstract class BaseRepository
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
static BaseRepository()
|
2018-05-21 17:12:57 -04:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
SqlMapper.AddTypeHandler(new DateTimeHandler());
|
2018-05-21 17:12:57 -04:00
|
|
|
|
}
|
2022-08-29 15:53:48 -04:00
|
|
|
|
|
|
|
|
|
|
public BaseRepository(string connectionString, string readOnlyConnectionString)
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
if (string.IsNullOrWhiteSpace(connectionString))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(connectionString));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(readOnlyConnectionString))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(readOnlyConnectionString));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionString = connectionString;
|
|
|
|
|
|
ReadOnlyConnectionString = readOnlyConnectionString;
|
2016-02-06 11:09:55 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-29 15:53:48 -04:00
|
|
|
|
protected string ConnectionString { get; private set; }
|
|
|
|
|
|
protected string ReadOnlyConnectionString { get; private set; }
|
2016-02-06 11:09:55 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|