Once again, I think that perhaps the obvious is lacking. I am looking for auto-binding by agreements. I watched the Ninject.extension.conventions project and build scanner.
What I have is a lot of lines that look like this: I would like to auto-bind:
Bind<ICommandHandler<MyCommand>>().To<MyCommandHandler>(); Bind<ICommandHandler<MyOtherCommand>>().To<MyOtherCommandHander>();
I tried several options:
Kernal.Scan(x => { x.FromAssemblyContaining<MyCommand>(); x.WhereTypeInheritsFrom(typeof(ICommandHander<>)); x.BindWith(new DefaultBindingGenerator()); });
But instances are not returned when:
kernel.Get<ICommandHandler<T>>();
source share