2016-02-06 11:09:55 -05:00
|
|
|
|
using System;
|
2018-05-21 17:12:57 -04:00
|
|
|
|
using Dapper;
|
2016-02-06 11:09:55 -05:00
|
|
|
|
|
2022-01-11 10:40:51 +01:00
|
|
|
|
namespace Bit.Infrastructure.Dapper.Repositories
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
|
|
|
|
|
public abstract class BaseRepository
|
|
|
|
|
|
{
|
2018-05-21 17:12:57 -04:00
|
|
|
|
static BaseRepository()
|
|
|
|
|
|
{
|
|
|
|
|
|
SqlMapper.AddTypeHandler(new DateTimeHandler());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-10-09 17:21:12 -04:00
|
|
|
|
public BaseRepository(string connectionString, string readOnlyConnectionString)
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
2020-03-27 14:36:37 -04:00
|
|
|
|
if (string.IsNullOrWhiteSpace(connectionString))
|
2016-02-06 11:09:55 -05:00
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(connectionString));
|
|
|
|
|
|
}
|
2020-03-27 14:36:37 -04:00
|
|
|
|
if (string.IsNullOrWhiteSpace(readOnlyConnectionString))
|
2018-10-09 17:21:12 -04:00
|
|
|
|
{
|
|
|
|
|
|
throw new ArgumentNullException(nameof(readOnlyConnectionString));
|
|
|
|
|
|
}
|
2016-02-06 11:09:55 -05:00
|
|
|
|
|
|
|
|
|
|
ConnectionString = connectionString;
|
2018-10-09 17:21:12 -04:00
|
|
|
|
ReadOnlyConnectionString = readOnlyConnectionString;
|
2016-02-06 11:09:55 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected string ConnectionString { get; private set; }
|
2018-10-09 17:21:12 -04:00
|
|
|
|
protected string ReadOnlyConnectionString { get; private set; }
|
2016-02-06 11:09:55 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|