I'm new to automatic dependency injection and trying to cleanly implement Ninject with an MVC4 application. Everything is functional but the OCD in me is wondering how an application will scale in terms of listing bindings in the RegisterServices(IKernel kernel) method in NinjectWebCommon.cs. For example,
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
kernel.Bind<IAbstractManagerA>().To<ConcreteManagerA>();
kernel.Bind<IAbstractManagerB>().To<ConcreteManagerB>();
kernel.Bind<IAbstractRepoA>().To<ConcreteRepoA>();
...etc etc could be hundreds
}
Is there a better way to handle this? Maybe have each pairing as a web.config setting or some other config file? Essentially inject the dependencies for the dependency injection :)
<add name="Production" value="true" />
) and leave type names completely out of the XML. – Pernambuco