mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
Fixed petapoco's craptastic connection management.
This commit is contained in:
parent
52e6d09325
commit
a5527df584
4 changed files with 47 additions and 27 deletions
|
@ -45,19 +45,17 @@ namespace NzbDrone.Core.Datastore
|
|||
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
||||
{
|
||||
MigrationsHelper.Run(connectionString, true);
|
||||
var sqliteConnection = new SqlCeConnection(connectionString);
|
||||
DbConnection connection = sqliteConnection;
|
||||
|
||||
if (profiled)
|
||||
{
|
||||
connection = ProfiledDbConnection.Get(sqliteConnection);
|
||||
}
|
||||
var factory = new PetaDbProviderFactory
|
||||
{
|
||||
IsProfiled = profiled
|
||||
};
|
||||
|
||||
var db = new Database(connection, Database.DBType.SqlServerCE);
|
||||
db.ForceDateTimesToUtc = false;
|
||||
|
||||
if (connection.State != ConnectionState.Open)
|
||||
connection.Open();
|
||||
var db = new Database(connectionString, factory, Database.DBType.SqlServerCE)
|
||||
{
|
||||
KeepConnectionAlive = true,
|
||||
ForceDateTimesToUtc = false,
|
||||
};
|
||||
|
||||
return db;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue