diff --git a/src/Ninject/KernelBase.cs b/src/Ninject/KernelBase.cs index d4145974..de37e37b 100644 --- a/src/Ninject/KernelBase.cs +++ b/src/Ninject/KernelBase.cs @@ -599,5 +599,23 @@ public int Compare(IBinding x, IBinding y) return q.FirstOrDefault(); } } + + /// + /// Decorates one type with another + /// + /// The type to be decorated + /// The decorator that must inherit from the type it is decorating + /// The resulting binding + public IBindingWhenInNamedWithOrOnSyntax Decorate() + where WithThis : DecorateThis + { + var binding = GetBindings(typeof(DecorateThis)) + .Last(); + var lowerBinding = new BindingConfigurationBuilder(binding + .BindingConfiguration, binding.Metadata.Name, this); + var bindingSyntax = Bind(); + lowerBinding.WhenInjectedInto(); + return bindingSyntax.To(); + } } } \ No newline at end of file