mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
cleanup
This commit is contained in:
parent
3592cf530d
commit
57e78e31fe
6 changed files with 71 additions and 35 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Data.SQLite;
|
||||
using Marr.Data;
|
||||
using Marr.Data.Reflection;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
|
||||
|
@ -12,6 +13,7 @@ namespace NzbDrone.Core.Datastore
|
|||
IDatabase Create(string dbPath, MigrationType migrationType = MigrationType.Main);
|
||||
}
|
||||
|
||||
[Singleton]
|
||||
public class DbFactory : IDbFactory
|
||||
{
|
||||
private readonly IMigrationController _migrationController;
|
||||
|
@ -31,14 +33,19 @@ namespace NzbDrone.Core.Datastore
|
|||
var connectionString = GetConnectionString(dbPath);
|
||||
|
||||
_migrationController.MigrateToLatest(connectionString, migrationType);
|
||||
var dataMapper = new DataMapper(SQLiteFactory.Instance, connectionString)
|
||||
{
|
||||
SqlMode = SqlModes.Text,
|
||||
};
|
||||
|
||||
|
||||
MapRepository.Instance.ReflectionStrategy = new SimpleReflectionStrategy();
|
||||
|
||||
return new Database(dataMapper);
|
||||
return new Database(() =>
|
||||
{
|
||||
var dataMapper = new DataMapper(SQLiteFactory.Instance, connectionString)
|
||||
{
|
||||
SqlMode = SqlModes.Text,
|
||||
};
|
||||
|
||||
return dataMapper;
|
||||
});
|
||||
}
|
||||
|
||||
private string GetConnectionString(string dbPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue