Merge pull request #559 from chlupac/ThemeRepository

OqtaneIgnore implementation to theme elements
This commit is contained in:
Shaun Walker 2020-05-29 10:42:33 -04:00 committed by GitHub
commit 17ef268594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -195,7 +195,7 @@ namespace Oqtane.Repository
if (modulecontroltype.Name == "ModuleBase" if (modulecontroltype.Name == "ModuleBase"
|| modulecontroltype.IsGenericType || modulecontroltype.IsGenericType
|| modulecontroltype.IsAbstract || modulecontroltype.IsAbstract
|| Attribute.IsDefined(modulecontroltype, typeof(OqtaneIgnoreAttribute)) || modulecontroltype.IsOqtaneIgnore()
) continue; ) continue;
string moduleNamespace = modulecontroltype.Namespace; string moduleNamespace = modulecontroltype.Namespace;

View File

@ -50,7 +50,7 @@ namespace Oqtane.Repository
// Check if type should be ignored // Check if type should be ignored
if (themeControlType.Name == "ThemeBase" if (themeControlType.Name == "ThemeBase"
|| themeControlType.IsGenericType || themeControlType.IsGenericType
|| Attribute.IsDefined(themeControlType, typeof(OqtaneIgnoreAttribute)) || themeControlType.IsOqtaneIgnore()
) continue; ) continue;
string themeNamespace = themeControlType.Namespace; string themeNamespace = themeControlType.Namespace;
@ -62,6 +62,7 @@ namespace Oqtane.Repository
// Find all types in the assembly which have the same namespace-root as the theme file // Find all types in the assembly which have the same namespace-root as the theme file
// Check with "." in the end to // Check with "." in the end to
List<Type> typesInTheme = assembly.GetTypes() List<Type> typesInTheme = assembly.GetTypes()
.Where(item=>!item.IsOqtaneIgnore())
.Where(item => item.Namespace != null) .Where(item => item.Namespace != null)
// Namespace must be the same or start with "xxx." to ensure that // Namespace must be the same or start with "xxx." to ensure that
// similar namespaces like "MyTheme" and "MyTheme2" don't match in StartsWith(...) // similar namespaces like "MyTheme" and "MyTheme2" don't match in StartsWith(...)

View File

@ -79,5 +79,10 @@ namespace System.Reflection
.Where(a => a.GetTypes<IModuleControl>().Any() || a.GetTypes<IThemeControl>().Any() || a.GetTypes<IClientStartup>().Any()) .Where(a => a.GetTypes<IModuleControl>().Any() || a.GetTypes<IThemeControl>().Any() || a.GetTypes<IClientStartup>().Any())
.Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client"); .Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client");
} }
public static bool IsOqtaneIgnore(this Type type)
{
return Attribute.IsDefined(type, typeof(OqtaneIgnoreAttribute));
}
} }
} }