diff --git a/Oqtane.Server/Repository/ModuleDefinitionRepository.cs b/Oqtane.Server/Repository/ModuleDefinitionRepository.cs index 9cf698a5..4a600a62 100644 --- a/Oqtane.Server/Repository/ModuleDefinitionRepository.cs +++ b/Oqtane.Server/Repository/ModuleDefinitionRepository.cs @@ -195,7 +195,7 @@ namespace Oqtane.Repository if (modulecontroltype.Name == "ModuleBase" || modulecontroltype.IsGenericType || modulecontroltype.IsAbstract - || Attribute.IsDefined(modulecontroltype, typeof(OqtaneIgnoreAttribute)) + || modulecontroltype.IsOqtaneIgnore() ) continue; string moduleNamespace = modulecontroltype.Namespace; diff --git a/Oqtane.Server/Repository/ThemeRepository.cs b/Oqtane.Server/Repository/ThemeRepository.cs index 33012004..13fe85dc 100644 --- a/Oqtane.Server/Repository/ThemeRepository.cs +++ b/Oqtane.Server/Repository/ThemeRepository.cs @@ -50,7 +50,7 @@ namespace Oqtane.Repository // Check if type should be ignored if (themeControlType.Name == "ThemeBase" || themeControlType.IsGenericType - || Attribute.IsDefined(themeControlType, typeof(OqtaneIgnoreAttribute)) + || themeControlType.IsOqtaneIgnore() ) continue; 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 // Check with "." in the end to List typesInTheme = assembly.GetTypes() + .Where(item=>!item.IsOqtaneIgnore()) .Where(item => item.Namespace != null) // Namespace must be the same or start with "xxx." to ensure that // similar namespaces like "MyTheme" and "MyTheme2" don't match in StartsWith(...) diff --git a/Oqtane.Shared/Extensions/AssemblyExtensions.cs b/Oqtane.Shared/Extensions/AssemblyExtensions.cs index fc873fe2..d02053f4 100644 --- a/Oqtane.Shared/Extensions/AssemblyExtensions.cs +++ b/Oqtane.Shared/Extensions/AssemblyExtensions.cs @@ -79,5 +79,10 @@ namespace System.Reflection .Where(a => a.GetTypes().Any() || a.GetTypes().Any() || a.GetTypes().Any()) .Where(a => Utilities.GetFullTypeName(a.GetName().Name) != "Oqtane.Client"); } + + public static bool IsOqtaneIgnore(this Type type) + { + return Attribute.IsDefined(type, typeof(OqtaneIgnoreAttribute)); + } } }