PluginOrderAttribute
NexusLabs.Needlr¶
NexusLabs.Needlr¶
PluginOrderAttribute Class¶
Specifies the execution order for a plugin. Lower values execute first. Plugins without this attribute default to Order = 0.
Inheritance System.Object 🡒 System.Attribute 🡒 PluginOrderAttribute
Remarks¶
Use this attribute to control the order in which plugins are executed. This is useful when plugins have dependencies on each other or when certain plugins must run before or after others.
Example usage:
// Infrastructure plugins run first (negative order)
[PluginOrder(-100)]
public class DatabaseMigrationPlugin : IServiceCollectionPlugin { }
// Default order (0) - no attribute needed
public class BusinessLogicPlugin : IServiceCollectionPlugin { }
// Validation plugins run last (positive order)
[PluginOrder(100)]
public class ValidationPlugin : IServiceCollectionPlugin { }
When multiple plugins have the same order, they are sorted alphabetically by their fully qualified type name to ensure deterministic execution order.
Constructors¶
PluginOrderAttribute(int) Constructor¶
Initializes a new instance of PluginOrderAttribute with the specified order.
Parameters¶
order System.Int32
The execution order. Lower values execute first. Negative values run before default (0), positive values run after.
Properties¶
PluginOrderAttribute.Order Property¶
Gets the execution order. Lower values execute first.