< Summary

Information
Class: NexusLabs.Needlr.PluginOrderAttribute
Assembly: NexusLabs.Needlr
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr/PluginOrderAttribute.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 49
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Order()100%11100%
.ctor(...)100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr/PluginOrderAttribute.cs

#LineLine coverage
 1namespace NexusLabs.Needlr;
 2
 3/// <summary>
 4/// Specifies the execution order for a plugin. Lower values execute first.
 5/// Plugins without this attribute default to Order = 0.
 6/// </summary>
 7/// <remarks>
 8/// <para>
 9/// Use this attribute to control the order in which plugins are executed.
 10/// This is useful when plugins have dependencies on each other or when
 11/// certain plugins must run before or after others.
 12/// </para>
 13/// <para>
 14/// Example usage:
 15/// <code>
 16/// // Infrastructure plugins run first (negative order)
 17/// [PluginOrder(-100)]
 18/// public class DatabaseMigrationPlugin : IServiceCollectionPlugin { }
 19///
 20/// // Default order (0) - no attribute needed
 21/// public class BusinessLogicPlugin : IServiceCollectionPlugin { }
 22///
 23/// // Validation plugins run last (positive order)
 24/// [PluginOrder(100)]
 25/// public class ValidationPlugin : IServiceCollectionPlugin { }
 26/// </code>
 27/// </para>
 28/// <para>
 29/// When multiple plugins have the same order, they are sorted alphabetically
 30/// by their fully qualified type name to ensure deterministic execution order.
 31/// </para>
 32/// </remarks>
 33[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
 34public sealed class PluginOrderAttribute : Attribute
 35{
 36    /// <summary>
 37    /// Gets the execution order. Lower values execute first.
 38    /// </summary>
 82039    public int Order { get; }
 40
 41    /// <summary>
 42    /// Initializes a new instance of <see cref="PluginOrderAttribute"/> with the specified order.
 43    /// </summary>
 44    /// <param name="order">
 45    /// The execution order. Lower values execute first.
 46    /// Negative values run before default (0), positive values run after.
 47    /// </param>
 656048    public PluginOrderAttribute(int order) => Order = order;
 49}

Methods/Properties

get_Order()
.ctor(System.Int32)