Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.0.1-preview-724" />

 DecoratorRule

using Stashbox.Resolution; namespace Stashbox.Registration.SelectionRules { internal class DecoratorRule : IRegistrationSelectionRule { public bool IsValidForCurrentRequest(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext) { return !resolutionContext.CurrentDecorators.ContainsReference(registration); } public bool ShouldIncrementWeight(TypeInformation typeInformation, ServiceRegistration registration, ResolutionContext resolutionContext) { return false; } } }