mirror of
https://github.com/Readarr/Readarr
synced 2025-12-06 16:32:51 +01:00
Used ReflectionOnly and/or public types where possible to avoid loading related assemblies unnecessarily.
This commit is contained in:
parent
7661b5bc87
commit
a8d4aa6770
2 changed files with 3 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ public static List<PropertyInfo> GetSimpleProperties(this Type type)
|
||||||
|
|
||||||
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 @@ public static T[] GetAttributes<T>(this MemberInfo member)
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ private static void InitializeEnvironment()
|
||||||
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…
Reference in a new issue