From a8d4aa6770960b5f76fc3306c0ccd3e3de43fe2c Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Wed, 21 Aug 2019 20:19:05 +0200 Subject: [PATCH] Used ReflectionOnly and/or public types where possible to avoid loading related assemblies unnecessarily. --- src/NzbDrone.Common/Reflection/ReflectionExtensions.cs | 4 ++-- src/NzbDrone.Core/Datastore/DbFactory.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs b/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs index 6fe86817f..b2526fea8 100644 --- a/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs +++ b/src/NzbDrone.Common/Reflection/ReflectionExtensions.cs @@ -17,7 +17,7 @@ public static List GetSimpleProperties(this Type type) public static List ImplementationsOf(this Assembly assembly) { - return assembly.GetTypes().Where(c => typeof(T).IsAssignableFrom(c)).ToList(); + return assembly.GetExportedTypes().Where(c => typeof(T).IsAssignableFrom(c)).ToList(); } public static bool IsSimpleType(this Type type) @@ -68,7 +68,7 @@ public static T[] GetAttributes(this MemberInfo member) public static Type FindTypeByName(this Assembly assembly, string name) { - return assembly.GetTypes().SingleOrDefault(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); + return assembly.GetExportedTypes().SingleOrDefault(c => c.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); } public static bool HasAttribute(this Type type) diff --git a/src/NzbDrone.Core/Datastore/DbFactory.cs b/src/NzbDrone.Core/Datastore/DbFactory.cs index fb7d54795..f86623394 100644 --- a/src/NzbDrone.Core/Datastore/DbFactory.cs +++ b/src/NzbDrone.Core/Datastore/DbFactory.cs @@ -40,6 +40,7 @@ private static void InitializeEnvironment() Environment.SetEnvironmentVariable("No_Expand", "true"); Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true"); Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true"); + Environment.SetEnvironmentVariable("No_SQLiteFunctions", "true"); } public DbFactory(IMigrationController migrationController,