Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.0.0-preview-717" />

 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; } } }