Reputation: 161
First off, here's the code:
Binding in the NinjectControllerFactory
class MrBigglesworthServices : NinjectModule
{
public override void Load()
{
Bind<IAuthenticationRepository>()
.To<AuthenticationRepository>()
.WithConstructorArgument("connectionString",
ConfigurationManager.ConnectionStrings["VoiceDB"].ConnectionString
);
Bind<IAppRepository>()
.To<AppRepository>()
.WithConstructorArgument("connectionString",
ConfigurationManager.ConnectionStrings["SessionStore"].ConnectionString
);
}
}
Constructor for the Search Controller:
private IAppRepository appRepository;
public SearchController(IAppRepository appRepository)
{
this.appRepository = appRepository;
}
Based on what I've seen with online examples, this should be enough, but for some reason, it's bringing up the error mentioned above. Any suggestions? Please and thank you.
Upvotes: 0
Views: 1728
Reputation: 32725
Because you mention using a NinjectControllerFactory
I think you are using an incorrect implementation. Consider to switch to https://github.com/ninject/ninject.web.mvc/wiki/MVC3 instead. This is a widely used integration of Ninject and MVC3.
Upvotes: 1