2022-06-30 01:46:41 +02:00
|
|
|
|
using Dapper;
|
2016-02-06 17:09:55 +01:00
|
|
|
|
|
2022-08-29 21:53:48 +02:00
|
|
|
|
namespace Bit.Infrastructure.Dapper.Repositories
|
2016-02-06 17:09:55 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
public abstract class BaseRepository
|
2016-02-06 17:09:55 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
static BaseRepository()
|
2018-05-21 23:12:57 +02:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02:00
|
|
|
|
SqlMapper.AddTypeHandler(new DateTimeHandler());
|
2018-05-21 23:12:57 +02:00
|
|
|
|
}
|
2022-08-29 21:53:48 +02:00
|
|
|
|
|
|
|
|
|
public BaseRepository(string connectionString, string readOnlyConnectionString)
|
2016-02-06 17:09:55 +01:00
|
|
|
|
{
|
2022-08-29 21:53:48 +02: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 17:09:55 +01:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-29 21:53:48 +02:00
|
|
|
|
protected string ConnectionString { get; private set; }
|
|
|
|
|
protected string ReadOnlyConnectionString { get; private set; }
|
2016-02-06 17:09:55 +01:00
|
|
|
|
}
|
|
|
|
|
}
|