Skip to content

GeneratedAssemblyProvider

NexusLabs.Needlr.Injection.SourceGen

NexusLabs.Needlr.Injection.SourceGen.Loaders

GeneratedAssemblyProvider Class

An assembly provider that derives assemblies from the generated TypeRegistry.

public sealed class GeneratedAssemblyProvider : NexusLabs.Needlr.Injection.IAssemblyProvider

Inheritance System.Object 🡒 GeneratedAssemblyProvider

Implements NexusLabs.Needlr.Injection.IAssemblyProvider

Remarks

When using source generation, the TypeRegistry contains all injectable types and plugins discovered at compile time. Generated bootstraps also provide a registry participant type so assemblies with no injectable types or plugins remain available without runtime assembly scanning.

This provider should be used with GeneratedPluginFactory to ensure that all generated registry participants are included in plugin discovery when runtime assembly metadata is available.

For assembly ordering, use SyringeExtensions.OrderAssemblies after configuring the Syringe.

Constructors

GeneratedAssemblyProvider(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>) Constructor

Initializes a new instance of the GeneratedAssemblyProvider class.

public GeneratedAssemblyProvider(System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypesProvider, System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypesProvider);

Parameters

injectableTypesProvider System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>>

A function that returns the injectable types.

pluginTypesProvider System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>>

A function that returns the plugin types.

Remarks

This compatibility overload can derive assemblies only from injectable and plugin metadata. Use the three-argument overload when generated registry participant types are available.

GeneratedAssemblyProvider(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>, IReadOnlyList<Type>) Constructor

Initializes a new instance of the GeneratedAssemblyProvider class.

public GeneratedAssemblyProvider(System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypesProvider, System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypesProvider, System.Collections.Generic.IReadOnlyList<System.Type> registryParticipantTypes);

Parameters

injectableTypesProvider System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>>

A function that returns the injectable types.

pluginTypesProvider System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>>

A function that returns the plugin types.

registryParticipantTypes System.Collections.Generic.IReadOnlyList<System.Type>

Generated types whose assemblies identify every TypeRegistry participant.

Remarks

Assemblies represented by injectable and plugin metadata preserve their existing order. Marker-only participant assemblies are appended in registration order.