2013-03-25 03:51:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Marr.Data;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Datastore
|
|
|
|
|
{
|
|
|
|
|
public interface IDatabase
|
|
|
|
|
{
|
2013-07-16 00:45:49 +00:00
|
|
|
|
IDataMapper GetDataMapper();
|
2013-03-25 03:51:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Database : IDatabase
|
|
|
|
|
{
|
2013-05-11 20:06:57 +00:00
|
|
|
|
private readonly Func<IDataMapper> _dataMapperFactory;
|
2013-03-25 03:51:32 +00:00
|
|
|
|
|
2013-05-11 20:06:57 +00:00
|
|
|
|
public Database(Func<IDataMapper> dataMapperFactory)
|
2013-03-25 03:51:32 +00:00
|
|
|
|
{
|
2013-05-11 20:06:57 +00:00
|
|
|
|
_dataMapperFactory = dataMapperFactory;
|
2013-03-25 03:51:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-16 00:45:49 +00:00
|
|
|
|
public IDataMapper GetDataMapper()
|
2013-05-11 20:06:57 +00:00
|
|
|
|
{
|
2013-07-16 00:45:49 +00:00
|
|
|
|
return _dataMapperFactory();
|
2013-05-11 20:06:57 +00:00
|
|
|
|
}
|
2013-03-25 03:51:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|