Skip to content

SkipAutoRegistration ​

Excludes a type from assembly scanning performed by RegisterOnInherit. Apply it to a concrete type that would otherwise be discovered but should be registered by hand.

It is honored unconditionally, so a type carrying it is never registered even when a filter predicate would accept it, while TypeDiscovery.FindAssignableTypes ignores it entirely as a raw reflection primitive.

Usage ​

csharp
using AlmightyShogun.Utils;
using Microsoft.Extensions.DependencyInjection;

builder.Services.RegisterOnInherit<IImportStep>(ServiceLifetime.Scoped);

builder.Services
    .AddScoped<IImportStep>(provider => new LegacyImportStep("legacy"));
csharp
using AlmightyShogun.Utils;

[SkipAutoRegistration]
public sealed class LegacyImportStep(string profile) : IImportStep
{
    public Task RunAsync() => Task.CompletedTask;
}

Type signature ​

csharp
[AttributeUsage(AttributeTargets.Class)]
public sealed class SkipAutoRegistrationAttribute : Attribute;

All packages are released under the MIT License.