Used ReflectionOnly and/or public types where possible to avoid loading related assemblies unnecessarily.

This commit is contained in:
Taloth Saldono 2019-08-21 20:19:05 +02:00
parent 9b8ec78502
commit 6a393ef6a2
7 changed files with 8 additions and 7 deletions

View File

@ -11,7 +11,7 @@ using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Api.Indexers
{
class ReleasePushModule : ReleaseModuleBase
public class ReleasePushModule : ReleaseModuleBase
{
private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IProcessDownloadDecisions _downloadDecisionProcessor;

View File

@ -3,7 +3,7 @@ using Nancy;
namespace NzbDrone.Api.Profiles
{
class LegacyProfileModule : NzbDroneApiModule
public class LegacyProfileModule : NzbDroneApiModule
{
public LegacyProfileModule()
: base("qualityprofile")

View File

@ -3,7 +3,7 @@ using Nancy;
namespace NzbDrone.Api.Wanted
{
class LegacyMissingModule : NzbDroneApiModule
public class LegacyMissingModule : NzbDroneApiModule
{
public LegacyMissingModule() : base("missing")
{

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Common.Composition
foreach (var assembly in assemblies)
{
_loadedTypes.AddRange(Assembly.Load(assembly).GetTypes());
_loadedTypes.AddRange(Assembly.Load(assembly).GetExportedTypes());
}
Container = new Container(new TinyIoCContainer(), _loadedTypes);

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Common.Reflection
public static List<Type> ImplementationsOf<T>(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)
@ -67,7 +67,7 @@ namespace NzbDrone.Common.Reflection
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<TAttribute>(this Type type)

View File

@ -40,6 +40,7 @@ namespace NzbDrone.Core.Datastore
Environment.SetEnvironmentVariable("No_Expand", "true");
Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true");
Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true");
Environment.SetEnvironmentVariable("No_SQLiteFunctions", "true");
}
public static void RegisterDatabase(IContainer container)

View File

@ -12,7 +12,7 @@ using NzbDrone.Core.Parser.Model;
namespace Sonarr.Api.V3.Indexers
{
class ReleasePushModule : ReleaseModuleBase
public class ReleasePushModule : ReleaseModuleBase
{
private readonly IMakeDownloadDecision _downloadDecisionMaker;
private readonly IProcessDownloadDecisions _downloadDecisionProcessor;