Skip to content

Commit

Permalink
Used ReflectionOnly and/or public types where possible
Browse files Browse the repository at this point in the history
Fixes #1461
  • Loading branch information
Qstick committed Jun 5, 2022
1 parent 6c708a7 commit 26b5db3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/NzbDrone.Common/Composition/Extensions.cs
Expand Up @@ -32,7 +32,7 @@ public static IContainer AutoAddServices(this IContainer container, List<string>
serviceTypeCondition: type => !type.IsInterface && !string.IsNullOrWhiteSpace(type.FullName) && !type.FullName.StartsWith("System"),
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);

return container;
Expand Down
4 changes: 2 additions & 2 deletions src/NzbDrone.Common/Reflection/ReflectionExtensions.cs
Expand Up @@ -17,7 +17,7 @@ public static List<PropertyInfo> GetSimpleProperties(this Type type)

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)
Expand Down Expand Up @@ -68,7 +68,7 @@ public static T[] GetAttributes<T>(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<TAttribute>(this Type type)
Expand Down
1 change: 1 addition & 0 deletions src/NzbDrone.Core/Datastore/DbFactory.cs
Expand Up @@ -36,6 +36,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,
Expand Down

0 comments on commit 26b5db3

Please sign in to comment.