|
|
|
@ -18,82 +18,36 @@ namespace NzbDrone.Core.Datastore
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String MainConnectionString
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return String.Format("Data Source={0};Version=3;", Path.Combine(AppDataPath.FullName, "nzbdrone.db"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String LogConnectionString
|
|
|
|
|
public static string GetConnectionString(string path)
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return String.Format("Data Source={0};Version=3;", Path.Combine(AppDataPath.FullName, "log.db"));
|
|
|
|
|
}
|
|
|
|
|
return String.Format("Data Source={0};Version=3;", path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static IDataProvider _mainDataProvider;
|
|
|
|
|
public static IDataProvider MainDataProvider
|
|
|
|
|
public static String MainConnectionString
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_mainDataProvider == null)
|
|
|
|
|
{
|
|
|
|
|
_mainDataProvider = ProviderFactory.GetProvider(Connection.MainConnectionString, "System.Data.SQLite");
|
|
|
|
|
}
|
|
|
|
|
return _mainDataProvider;
|
|
|
|
|
return GetConnectionString(Path.Combine(AppDataPath.FullName, "nzbdrone.db"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static IDataProvider _logDataProvider;
|
|
|
|
|
public static IDataProvider LogDataProvider
|
|
|
|
|
public static String LogConnectionString
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_logDataProvider == null)
|
|
|
|
|
{
|
|
|
|
|
_logDataProvider = ProviderFactory.GetProvider(Connection.LogConnectionString, "System.Data.SQLite");
|
|
|
|
|
}
|
|
|
|
|
return _logDataProvider;
|
|
|
|
|
return GetConnectionString(Path.Combine(AppDataPath.FullName, "log.db"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static SimpleRepository _mainDataRepository;
|
|
|
|
|
public static SimpleRepository MainDataRepository
|
|
|
|
|
public static IDataProvider GetDataProvider(string connectionString)
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_mainDataRepository == null)
|
|
|
|
|
{
|
|
|
|
|
_mainDataRepository = new SimpleRepository(MainDataProvider, SimpleRepositoryOptions.RunMigrations);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _mainDataRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ProviderFactory.GetProvider(connectionString, "System.Data.SQLite");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static SimpleRepository _logDataRepository;
|
|
|
|
|
public static SimpleRepository LogDataRepository
|
|
|
|
|
public static IRepository CreateSimpleRepository(string connectionString)
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_logDataRepository == null)
|
|
|
|
|
{
|
|
|
|
|
_logDataRepository = new SimpleRepository(LogDataProvider, SimpleRepositoryOptions.RunMigrations);
|
|
|
|
|
}
|
|
|
|
|
return _logDataRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new SimpleRepository(GetDataProvider(connectionString), SimpleRepositoryOptions.RunMigrations);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|