Skip to content

ReflectionTypeRegistrar

NexusLabs.Needlr.Injection.Reflection

NexusLabs.Needlr.Injection.Reflection.TypeRegistrars

ReflectionTypeRegistrar Class

Type registrar that uses runtime reflection to discover and register types.

public sealed class ReflectionTypeRegistrar : NexusLabs.Needlr.Injection.ITypeRegistrar

Inheritance System.Object 🡒 ReflectionTypeRegistrar

Implements NexusLabs.Needlr.Injection.ITypeRegistrar

Remarks

This registrar is not compatible with NativeAOT or trimming. For AOT scenarios, use GeneratedTypeRegistrar from NexusLabs.Needlr.Injection.SourceGen with the Needlr source generator instead.

Methods

ReflectionTypeRegistrar.RegisterTypesFromAssemblies(IServiceCollection, ITypeFilterer, IReadOnlyList<Assembly>) Method

Registers types from the specified assemblies into the service collection.

public void RegisterTypesFromAssemblies(Microsoft.Extensions.DependencyInjection.IServiceCollection services, NexusLabs.Needlr.Injection.ITypeFilterer typeFilterer, System.Collections.Generic.IReadOnlyList<System.Reflection.Assembly> assemblies);

Parameters

services Microsoft.Extensions.DependencyInjection.IServiceCollection

The service collection to register types into.

typeFilterer NexusLabs.Needlr.Injection.ITypeFilterer

The type filterer used to determine which types should be registered and their lifetimes.

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

The assemblies to scan for types to register.

Implements RegisterTypesFromAssemblies(IServiceCollection, ITypeFilterer, IReadOnlyList<Assembly>)