Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.12.1" />

 DecoratorRule

using Stashbox.Resolution; using System.Runtime.CompilerServices; namespace Stashbox.Registration.SelectionRules { internal class DecoratorRule : IRegistrationSelectionRule { [System.Runtime.CompilerServices.NullableContext(1)] public bool IsValidForCurrentRequest(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext, out bool shouldIncrementWeight) { shouldIncrementWeight = false; return !resolutionContext.CurrentDecorators.ContainsReference(registration); } } }