Skip to content

SyringeReflectionExtensions

NexusLabs.Needlr.Injection.Reflection

NexusLabs.Needlr.Injection.Reflection

SyringeReflectionExtensions Class

Extension methods for configuring NexusLabs.Needlr.Injection.Syringe with reflection-based components.

public static class SyringeReflectionExtensions

Inheritance System.Object 🡒 SyringeReflectionExtensions

Remarks

These extensions enable runtime reflection-based type discovery and registration. Use these when you need dynamic assembly loading or when source generation is not available.

For AOT/trimming compatibility, use NexusLabs.Needlr.Injection.SourceGen instead.

Methods

SyringeReflectionExtensions.UsingAssemblyProvider(this ConfiguredSyringe, Func<IAssemblyProviderBuilder,IAssemblyProvider>) Method

Configures the syringe to use a custom assembly provider built with the builder pattern.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingAssemblyProvider(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe, System.Func<NexusLabs.Needlr.Injection.Reflection.IAssemblyProviderBuilder,NexusLabs.Needlr.Injection.IAssemblyProvider> configure);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

configure System.Func<IAssemblyProviderBuilder,NexusLabs.Needlr.Injection.IAssemblyProvider>

A function to configure the assembly provider builder.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.

SyringeReflectionExtensions.UsingReflection(this Syringe) Method

Configures the syringe to use all reflection-based components.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingReflection(this NexusLabs.Needlr.Injection.Syringe syringe);

Parameters

syringe NexusLabs.Needlr.Injection.Syringe

The syringe to configure.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A configured syringe ready for further configuration and building.

Remarks

This sets the type registrar, type filterer, plugin factory, and assembly provider to their reflection-based implementations. Not compatible with AOT/trimming.

SyringeReflectionExtensions.UsingReflectionAssemblyProvider(this ConfiguredSyringe) Method

Configures the syringe to use the reflection-based assembly provider.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingReflectionAssemblyProvider(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.

SyringeReflectionExtensions.UsingReflectionPluginFactory(this ConfiguredSyringe) Method

Configures the syringe to use the reflection-based plugin factory.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingReflectionPluginFactory(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.

SyringeReflectionExtensions.UsingReflectionTypeFilterer(this ConfiguredSyringe) Method

Configures the syringe to use the reflection-based type filterer.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingReflectionTypeFilterer(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.

SyringeReflectionExtensions.UsingReflectionTypeRegistrar(this ConfiguredSyringe) Method

Configures the syringe to use the reflection-based type registrar.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe UsingReflectionTypeRegistrar(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.

SyringeReflectionExtensions.WithReflectionFallbackHandler(this ConfiguredSyringe, Action<ReflectionFallbackContext>) Method

Configures a handler to be invoked when reflection-based components are used as fallback.

public static NexusLabs.Needlr.Injection.ConfiguredSyringe WithReflectionFallbackHandler(this NexusLabs.Needlr.Injection.ConfiguredSyringe syringe, System.Action<NexusLabs.Needlr.Injection.Reflection.ReflectionFallbackContext> handler);

Parameters

syringe NexusLabs.Needlr.Injection.ConfiguredSyringe

The configured syringe to update.

handler System.Action<ReflectionFallbackContext>

The handler to invoke when reflection fallback occurs.

Returns

NexusLabs.Needlr.Injection.ConfiguredSyringe
A new configured syringe instance.