PluginTypeInfo
NexusLabs.Needlr.Generators¶
PluginTypeInfo Struct¶
Represents metadata about a plugin type discovered at compile time.
Remarks¶
This struct is used by the generated TypeRegistry to provide plugin factory methods without requiring reflection or Activator.CreateInstance at runtime.
Constructors¶
PluginTypeInfo(Type, IReadOnlyList<Type>, Func<object>) Constructor¶
Initializes a new instance of PluginTypeInfo.
public PluginTypeInfo(System.Type pluginType, System.Collections.Generic.IReadOnlyList<System.Type> pluginInterfaces, System.Func<object> factory);
Parameters¶
pluginType System.Type
The concrete plugin type.
pluginInterfaces System.Collections.Generic.IReadOnlyList<System.Type>
The plugin interfaces implemented by the type.
factory System.Func<System.Object>
A factory delegate that creates an instance of the plugin.
PluginTypeInfo(Type, IReadOnlyList<Type>, Func<object>, IReadOnlyList<Type>) Constructor¶
Initializes a new instance of PluginTypeInfo.
public PluginTypeInfo(System.Type pluginType, System.Collections.Generic.IReadOnlyList<System.Type> pluginInterfaces, System.Func<object> factory, System.Collections.Generic.IReadOnlyList<System.Type> attributes);
Parameters¶
pluginType System.Type
The concrete plugin type.
pluginInterfaces System.Collections.Generic.IReadOnlyList<System.Type>
The plugin interfaces implemented by the type.
factory System.Func<System.Object>
A factory delegate that creates an instance of the plugin.
attributes System.Collections.Generic.IReadOnlyList<System.Type>
The attribute types applied to the plugin type.
PluginTypeInfo(Type, IReadOnlyList<Type>, Func<object>, IReadOnlyList<Type>, int) Constructor¶
Initializes a new instance of PluginTypeInfo with execution order.
public PluginTypeInfo(System.Type pluginType, System.Collections.Generic.IReadOnlyList<System.Type> pluginInterfaces, System.Func<object> factory, System.Collections.Generic.IReadOnlyList<System.Type> attributes, int order);
Parameters¶
pluginType System.Type
The concrete plugin type.
pluginInterfaces System.Collections.Generic.IReadOnlyList<System.Type>
The plugin interfaces implemented by the type.
factory System.Func<System.Object>
A factory delegate that creates an instance of the plugin.
attributes System.Collections.Generic.IReadOnlyList<System.Type>
The attribute types applied to the plugin type.
order System.Int32
The execution order. Lower values execute first.
Properties¶
PluginTypeInfo.Attributes Property¶
Gets the attribute types applied to the plugin type.
Property Value¶
System.Collections.Generic.IReadOnlyList<System.Type>
Remarks¶
This enables attribute-based plugin filtering without requiring
reflection via GetCustomAttribute at runtime.
PluginTypeInfo.Factory Property¶
Gets a factory delegate that creates an instance of the plugin without using Activator.CreateInstance.
Property Value¶
PluginTypeInfo.Order Property¶
Gets the execution order for this plugin. Lower values execute first.
Property Value¶
Remarks¶
Plugins with lower order values are executed before those with higher values. The default order is 0. Use negative values for plugins that must run early (e.g., infrastructure setup) and positive values for plugins that must run late (e.g., validation, cleanup).
When multiple plugins have the same order, they are sorted alphabetically by their fully qualified type name for deterministic execution.
PluginTypeInfo.PluginInterfaces Property¶
Gets the plugin interfaces implemented by the type.
Property Value¶
System.Collections.Generic.IReadOnlyList<System.Type>
PluginTypeInfo.PluginType Property¶
Gets the concrete plugin type.
Property Value¶
Methods¶
PluginTypeInfo.HasAttribute(Type) Method¶
Checks if the plugin has an attribute of the specified type.
Parameters¶
attributeType System.Type
The attribute type to check for.
Returns¶
System.Boolean
True if the plugin has the attribute; otherwise, false.
PluginTypeInfo.HasAttribute<TAttribute>() Method¶
Checks if the plugin has an attribute of the specified type.
Type parameters¶
TAttribute
The attribute type to check for.
Returns¶
System.Boolean
True if the plugin has the attribute; otherwise, false.