Skip to content

AssemblyOrderBuilder

NexusLabs.Needlr.Injection

NexusLabs.Needlr.Injection.AssemblyOrdering

AssemblyOrderBuilder Class

Fluent builder for specifying assembly ordering rules. Assemblies are sorted into tiers based on the first matching rule. Unmatched assemblies are placed last.

public sealed class AssemblyOrderBuilder

Inheritance System.Object 🡒 AssemblyOrderBuilder

Properties

AssemblyOrderBuilder.Rules Property

Gets the ordering rules that have been configured.

public System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyOrderRule> Rules { get; }

Property Value

System.Collections.Generic.IReadOnlyList<AssemblyOrderRule>

Methods

AssemblyOrderBuilder.By(Expression<Func<AssemblyInfo,bool>>) Method

Adds the first ordering rule. Assemblies matching this expression go first.

public NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyOrderBuilder By(System.Linq.Expressions.Expression<System.Func<NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyInfo,bool>> predicate);

Parameters

predicate System.Linq.Expressions.Expression<System.Func<AssemblyInfo,System.Boolean>>

Expression that determines if an assembly matches this tier.

Returns

AssemblyOrderBuilder
The builder for chaining.

AssemblyOrderBuilder.Sort(IEnumerable<Assembly>) Method

Sorts assemblies according to the configured rules. Each assembly is placed in the first tier it matches. Unmatched assemblies are placed last.

public System.Collections.Generic.IReadOnlyList<System.Reflection.Assembly> Sort(System.Collections.Generic.IEnumerable<System.Reflection.Assembly> assemblies);

Parameters

assemblies System.Collections.Generic.IEnumerable<System.Reflection.Assembly>

The assemblies to sort.

Returns

System.Collections.Generic.IReadOnlyList<System.Reflection.Assembly>
The sorted assemblies.

AssemblyOrderBuilder.SortNames(IEnumerable<string>) Method

Sorts assembly names according to the configured rules. Used for source-gen scenarios where only names are available.

public System.Collections.Generic.IReadOnlyList<string> SortNames(System.Collections.Generic.IEnumerable<string> assemblyNames);

Parameters

assemblyNames System.Collections.Generic.IEnumerable<System.String>

The assembly names to sort.

Returns

System.Collections.Generic.IReadOnlyList<System.String>
The sorted assembly names.

AssemblyOrderBuilder.ThenBy(Expression<Func<AssemblyInfo,bool>>) Method

Adds a subsequent ordering rule. Assemblies matching this expression (and not matching any previous rules) go in the next tier.

public NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyOrderBuilder ThenBy(System.Linq.Expressions.Expression<System.Func<NexusLabs.Needlr.Injection.AssemblyOrdering.AssemblyInfo,bool>> predicate);

Parameters

predicate System.Linq.Expressions.Expression<System.Func<AssemblyInfo,System.Boolean>>

Expression that determines if an assembly matches this tier.

Returns

AssemblyOrderBuilder
The builder for chaining.