Skip to content

SourceGenRegistry

NexusLabs.Needlr

NexusLabs.Needlr

SourceGenRegistry Class

Static registry for source-generated registrations.

public static class SourceGenRegistry

Inheritance System.Object 🡒 SourceGenRegistry

Remarks

This class provides a decoupling layer between the core Needlr runtime and the source-generated bootstrap code. The source generator emits a module initializer that registers callbacks here, and the ConfiguredSyringe calls these callbacks during BuildServiceProvider.

This allows NexusLabs.Needlr.Injection to have no dependency on NexusLabs.Needlr.Generators.Attributes.

Methods

SourceGenRegistry.RegisterExtension(Action<object,object>) Method

Registers an extension registrar from extension packages.

public static void RegisterExtension(System.Action<object,object> registrar);

Parameters

registrar System.Action<System.Object,System.Object>

Action that registers extension services. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid package dependencies.

SourceGenRegistry.RegisterOptionsRegistrar(Action<object,object>) Method

Registers the options registrar from source-generated code.

public static void RegisterOptionsRegistrar(System.Action<object,object> registrar);

Parameters

registrar System.Action<System.Object,System.Object>

Action that registers options. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid package dependencies.

SourceGenRegistry.TryGetExtensionRegistrar(Action<object,object>) Method

Gets the extension registrar if one is registered.

public static bool TryGetExtensionRegistrar(out System.Action<object,object>? registrar);

Parameters

registrar System.Action<System.Object,System.Object>

Returns

System.Boolean

SourceGenRegistry.TryGetOptionsRegistrar(Action<object,object>) Method

Gets the options registrar if one is registered.

public static bool TryGetOptionsRegistrar(out System.Action<object,object>? registrar);

Parameters

registrar System.Action<System.Object,System.Object>

Returns

System.Boolean