diff --git a/Pilz.Plugins.Advanced/PluginFeatureController.cs b/Pilz.Plugins.Advanced/PluginFeatureController.cs
index 58c8528..a63a44f 100644
--- a/Pilz.Plugins.Advanced/PluginFeatureController.cs
+++ b/Pilz.Plugins.Advanced/PluginFeatureController.cs
@@ -62,7 +62,7 @@ public class PluginFeatureController
/// Registers all features found in the currently executing Assembly via , and .
/// Note:
Explicit implementations of can not be detected. For this case just implement instead.
///
- public void RegisterAllOwn()
+ public void RegisterAllOwn(string? @namespace = null)
{
RegisterAll(Assembly.GetCallingAssembly());
}
@@ -71,8 +71,9 @@ public class PluginFeatureController
/// Registers all features found in the given via , and .
/// Note:
Explicit implementations of can not be detected. For this case just implement instead.
///
- ///
- public void RegisterAll(Assembly[] assemblies)
+ /// The assemblies to query for types.
+ /// If not null, only types within the given namespace will be registered.
+ public void RegisterAll(Assembly[] assemblies, string? @namespace = null)
{
foreach (var assembly in assemblies)
RegisterAll(assembly);
@@ -82,8 +83,9 @@ public class PluginFeatureController
/// Registers all features found in the given via , and .
/// Note:
Explicit implementations of can not be detected. For this case just implement instead.
///
- ///
- public void RegisterAll(Assembly assembly)
+ /// The assembly to query for types.
+ /// If not null, only types within the given namespace will be registered.
+ public void RegisterAll(Assembly assembly, string? @namespace = null)
{
RegisterAll(assembly.GetTypes());
}
@@ -92,8 +94,9 @@ public class PluginFeatureController
/// Registers all features found from the given via , and .
/// Note:
Explicit implementations of can not be detected. For this case just implement instead.
///
- ///
- public void RegisterAll(Type[] types)
+ /// The types to query for providers.
+ /// If not null, the types will only be processed if they're within the given namespace.
+ public void RegisterAll(Type[] types, string? @namespace = null)
{
foreach (var type in types)
RegisterAll(type);
@@ -103,9 +106,13 @@ public class PluginFeatureController
/// Registers all features found from the given via , and .
/// Note:
Explicit implementations of can not be detected. For this case just implement instead.
///
- ///
- public void RegisterAll(Type type)
+ /// The type to query for providers.
+ /// If not null, the type will only be processed if it's within the given namespace.
+ public void RegisterAll(Type type, string? @namespace = null)
{
+ if (@namespace != null && type.Namespace != null && type.Namespace != @namespace && !type.Namespace.StartsWith(@namespace + "."))
+ return;
+
if (type.IsAssignableTo(typeof(IPluginFeaturesProvider)))
{
var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);