DoNotAutoRegisterAttribute
NexusLabs.Needlr¶
NexusLabs.Needlr¶
DoNotAutoRegisterAttribute Class¶
Prevents a class or interface from being automatically registered by Needlr's dependency injection discovery pipeline.
Inheritance System.Object 🡒 System.Attribute 🡒 DoNotAutoRegisterAttribute
Example¶
// This class is discovered during scanning but never added to the container
[DoNotAutoRegister]
public class InternalHelper : IHelper
{
// Registered manually or not at all
}
Remarks¶
Use this attribute when a type should be discovered (scanned) but not registered in the Microsoft.Extensions.DependencyInjection.IServiceCollection. Common scenarios include: - Types with a custom or conditional registration strategy. - Abstract base classes that should not be resolved directly. - Types registered manually elsewhere in the composition root.