My project is done using portable areas, I’m using ninject for DI, I’m injecting a class that is in other assembly, so I have this code in the areaRegistraction:
DependencyResolver.Current.GetService<IModuleManager>().Add(this.module);
IKernel kernel = DependencyResolver.Current.GetService<IKernel>();
kernel.Bind<IConfigurationRepository>().To<ConfigurationRepository>();
In my constructor I have this code:
public RequestController(IconfigurationRepository configurationRepository)
{
this.configurationRepository= configurationRepository;
}
But by some reason configurationRepository is null
But if I put:
public RequestController()
{
this.configurationRepository = ((StandardKernel)DependencyResolver.Current.GetService<IKernel>()).GetAll<IConfigurationRepository>().First();
}
It works fine. What is the different between them?
Any clue will be really appreciated.