Speed up sqlite3 initialization by disabling unused features.
This commit is contained in:
parent
740af2751a
commit
b7c5639a9d
|
@ -27,10 +27,20 @@ namespace NzbDrone.Core.Datastore
|
||||||
|
|
||||||
static DbFactory()
|
static DbFactory()
|
||||||
{
|
{
|
||||||
|
InitializeEnvironment();
|
||||||
|
|
||||||
MapRepository.Instance.ReflectionStrategy = new SimpleReflectionStrategy();
|
MapRepository.Instance.ReflectionStrategy = new SimpleReflectionStrategy();
|
||||||
TableMapping.Map();
|
TableMapping.Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void InitializeEnvironment()
|
||||||
|
{
|
||||||
|
// Speed up sqlite3 initialization since we don't use the config file and can't rely on preloading.
|
||||||
|
Environment.SetEnvironmentVariable("No_Expand", "true");
|
||||||
|
Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true");
|
||||||
|
Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true");
|
||||||
|
}
|
||||||
|
|
||||||
public static void RegisterDatabase(IContainer container)
|
public static void RegisterDatabase(IContainer container)
|
||||||
{
|
{
|
||||||
var mainDb = new MainDatabase(container.Resolve<IDbFactory>().Create());
|
var mainDb = new MainDatabase(container.Resolve<IDbFactory>().Create());
|
||||||
|
|
Loading…
Reference in New Issue