Ninject equivalent for the SimpleInjector RegisterDecorator method

I have the following code in an IoC Simple Injector container:

container.RegisterDecorator(typeof(ICommandHandler<>),
    typeof(ValidationCommandHandlerDecorator<>));

I need to translate this to the equivalent of Ninject. I read that the Decorator template in Ninject is executed using a method WhenInjectedInto, but for all the expectation, for example, 3 parameters are required:

Bind<IRepository>().To<SimpleRepository>
    .WhenInjectedInto<AdvancedRespository>();

This method in Simple Injector takes only 2, so could you tell me, please, what am I missing here?

+5
source share
2 answers

, RegisterDecorator SimpleInjector. , , , ICommandHandler, ValidationCommandHandlerDecorator, ICommandHandler . Ninject , . , - , .

Ninject?

+2

Simple Injector, , . ?

kernel.Bind(typeof(ICommandHandler<>))()
      .To(typeof(ValidationCommandHandlerDecorator<>))

, , .WhenInjectedInto()

+1

All Articles