NeedlrSourceGenBootstrap
NexusLabs.Needlr.Generators¶
NeedlrSourceGenBootstrap Class¶
Runtime bootstrap registry for source-generated Needlr components.
Inheritance System.Object 🡒 NeedlrSourceGenBootstrap
Remarks¶
The source generator emits a module initializer in the host assembly that calls one of the Register overloads with the generated TypeRegistry providers. Needlr runtime can then discover generated registries without any runtime reflection.
Methods¶
NeedlrSourceGenBootstrap.Register(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>) Method¶
Registers the generated type and plugin providers for this application.
public static void Register(System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypeProvider, System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypeProvider);
Parameters¶
injectableTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<InjectableTypeInfo>>
pluginTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<PluginTypeInfo>>
NeedlrSourceGenBootstrap.Register(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>, Action<object>) Method¶
Registers the generated type, plugin, and decorator providers for this application.
public static void Register(System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypeProvider, System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypeProvider, System.Action<object>? decoratorApplier);
Parameters¶
injectableTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<InjectableTypeInfo>>
Provider for injectable types.
pluginTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<PluginTypeInfo>>
Provider for plugin types.
decoratorApplier System.Action<System.Object>
Action that applies decorators to the service collection. The parameter is an IServiceCollection, but typed as object to avoid dependency on Microsoft.Extensions.DependencyInjection in this assembly.
NeedlrSourceGenBootstrap.Register(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>, Action<object>, Action<object,object>) Method¶
Registers the generated type, plugin, decorator, and options providers for this application.
public static void Register(System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypeProvider, System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypeProvider, System.Action<object>? decoratorApplier, System.Action<object,object>? optionsRegistrar);
Parameters¶
injectableTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<InjectableTypeInfo>>
Provider for injectable types.
pluginTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<PluginTypeInfo>>
Provider for plugin types.
decoratorApplier System.Action<System.Object>
Action that applies decorators to the service collection. The parameter is an IServiceCollection, but typed as object to avoid dependency on Microsoft.Extensions.DependencyInjection in this assembly.
optionsRegistrar System.Action<System.Object,System.Object>
Action that registers options with the service collection and configuration. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid dependencies.
NeedlrSourceGenBootstrap.RegisterExtension(Action<object,object>) Method¶
Registers an extension that provides additional service registrations. Extensions are invoked after the main options registrar during BuildServiceProvider.
Parameters¶
extensionRegistrar System.Action<System.Object,System.Object>
Action that registers extension services with the service collection and configuration. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid dependencies.
Remarks¶
Use this method from extension package module initializers to register additional services. For example, FluentValidation can register its validators without modifying core Needlr.
NeedlrSourceGenBootstrap.TryGetDecoratorApplier(Action<object>) Method¶
Gets the decorator applier (if any).
Parameters¶
decoratorApplier System.Action<System.Object>
Action that applies decorators to the service collection. The parameter is an IServiceCollection, but typed as object to avoid dependency on Microsoft.Extensions.DependencyInjection in this assembly.
Returns¶
System.Boolean
True if a decorator applier is registered.
NeedlrSourceGenBootstrap.TryGetExtensionRegistrar(Action<object,object>) Method¶
Gets the combined extension registrar (if any extensions are registered).
Parameters¶
extensionRegistrar System.Action<System.Object,System.Object>
Combined action that invokes all registered extensions. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid dependencies.
Returns¶
System.Boolean
True if any extension registrars are registered.
NeedlrSourceGenBootstrap.TryGetOptionsRegistrar(Action<object,object>) Method¶
Gets the options registrar (if any).
Parameters¶
optionsRegistrar System.Action<System.Object,System.Object>
Action that registers options with the service collection and configuration. Parameters are (IServiceCollection, IConfiguration), typed as object to avoid dependencies.
Returns¶
System.Boolean
True if an options registrar is registered.
NeedlrSourceGenBootstrap.TryGetProviders(Func<IReadOnlyList<InjectableTypeInfo>>, Func<IReadOnlyList<PluginTypeInfo>>) Method¶
Gets the registered providers (if any).
public static bool TryGetProviders(out System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.InjectableTypeInfo>> injectableTypeProvider, out System.Func<System.Collections.Generic.IReadOnlyList<NexusLabs.Needlr.Generators.PluginTypeInfo>> pluginTypeProvider);
Parameters¶
injectableTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<InjectableTypeInfo>>
pluginTypeProvider System.Func<System.Collections.Generic.IReadOnlyList<PluginTypeInfo>>