Used ReflectionOnly and/or public types where possible

Fixes #1461
pull/2833/head
Qstick 2 years ago
parent 6c708a7a3e
commit 26b5db3019

@ -32,7 +32,7 @@ namespace NzbDrone.Common.Composition.Extensions
serviceTypeCondition: type => !type.IsInterface && !string.IsNullOrWhiteSpace(type.FullName) && !type.FullName.StartsWith("System"), serviceTypeCondition: type => !type.IsInterface && !string.IsNullOrWhiteSpace(type.FullName) && !type.FullName.StartsWith("System"),
reuse: Reuse.Transient); reuse: Reuse.Transient);
var knownTypes = new KnownTypes(assemblies.SelectMany(x => x.GetTypes()).ToList()); var knownTypes = new KnownTypes(assemblies.SelectMany(x => x.GetExportedTypes()).ToList());
container.RegisterInstance(knownTypes); container.RegisterInstance(knownTypes);
return container; return container;

@ -17,7 +17,7 @@ namespace NzbDrone.Common.Reflection
public static List<Type> ImplementationsOf<T>(this Assembly assembly) 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) public static bool IsSimpleType(this Type type)
@ -68,7 +68,7 @@ namespace NzbDrone.Common.Reflection
public static Type FindTypeByName(this Assembly assembly, string name) 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) public static bool HasAttribute<TAttribute>(this Type type)

@ -36,6 +36,7 @@ namespace NzbDrone.Core.Datastore
Environment.SetEnvironmentVariable("No_Expand", "true"); Environment.SetEnvironmentVariable("No_Expand", "true");
Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true"); Environment.SetEnvironmentVariable("No_SQLiteXmlConfigFile", "true");
Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true"); Environment.SetEnvironmentVariable("No_PreLoadSQLite", "true");
Environment.SetEnvironmentVariable("No_SQLiteFunctions", "true");
} }
public DbFactory(IMigrationController migrationController, public DbFactory(IMigrationController migrationController,

Loading…
Cancel
Save