I've got an MVC 4 application that I want to use Ninject with. I've used NuGet for the Ninject 3 packages, however I'm having some difficulties with the configuration. The NuGet install created the file:
public static class NinjectWebCommon
{
// Not included for brevity
/// <summary>
/// Load your modules or register your services here!
/// </summary>
/// <param name="kernel">The kernel.</param>
private static void RegisterServices(IKernel kernel)
{
}
}
I have a class I'm using to strongly type my web config. I've called this class AppEnvironment, and it has an interface of IAppEnvironment for unit testing. I know that within the RegisterSevices function I can do:
kernel.Bind<IAppEnvironment>().To<AppEnvironment>();
However this means that I have to specify each binding one at a time. In a previous project we had Ninject configured to bind by default to a new instance of the interface with just the I of the interface class removed. I've taken a look at Using NInject to bind a generic interface, with a default if a binding for the generic type is not set however I'm not sure what the IService in .InheritedFrom(typeof(IService<>))
is for, and what I should be using for my configuration.
Any clues on how to get this working?