mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Log page now uses EF for faster runtime queries.
This commit is contained in:
parent
a984060533
commit
c6716f2425
49 changed files with 14898 additions and 555 deletions
|
@ -1,5 +1,10 @@
|
|||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Data.EntityClient;
|
||||
using System.Data.SqlServerCe;
|
||||
using MvcMiniProfiler;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using PetaPoco;
|
||||
|
||||
namespace NzbDrone.Core.Datastore
|
||||
|
@ -30,7 +35,7 @@ namespace NzbDrone.Core.Datastore
|
|||
{
|
||||
get
|
||||
{
|
||||
return GetConnectionString(_enviromentProvider.GetLogDbFileDbFile());
|
||||
return GetConnectionString(_enviromentProvider.GetLogDbFileDbFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,11 +55,18 @@ namespace NzbDrone.Core.Datastore
|
|||
return GetPetaPocoDb(LogConnectionString, profiled);
|
||||
}
|
||||
|
||||
public LogDbContext GetLogEfContext()
|
||||
{
|
||||
return GetLogDbContext(LogConnectionString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
||||
{
|
||||
MigrationsHelper.Run(connectionString, true);
|
||||
|
||||
var factory = new PetaDbProviderFactory
|
||||
var factory = new DbProviderFactory
|
||||
{
|
||||
IsProfiled = profiled
|
||||
};
|
||||
|
@ -68,5 +80,12 @@ namespace NzbDrone.Core.Datastore
|
|||
return db;
|
||||
}
|
||||
|
||||
public static LogDbContext GetLogDbContext(string connectionString)
|
||||
{
|
||||
MigrationsHelper.Run(connectionString, true);
|
||||
DbConnection connection = new SqlCeConnection(connectionString);
|
||||
return new LogDbContext(connection);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue