Thank you for your reply.
I didn't say I wasn't using Ninject.MVC. Ruben said that. And, by the way, this is not my first time using Ninject.MVC
These are the relevant portions of my Global.asax:
public class MvcApplication : NinjectHttpApplication
{
protected override void OnApplicationStarted()
{
base.OnApplicationStarted();
ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(CreateKernel()));
}
protected override IKernel CreateKernel()
{
return Container;
}
private static IKernel Container
{
get
{
IKernel kernel = new StandardKernel();
kernel.Load(new ServiceModule(), new RepositoryModule());
return kernel;
}
}
Without the custom NinjectControllerFactory, all I get is the dreaded "No parameterless constructor defined for this object" error.
I read in StackOverflow that this is a known occurrence when using Visual Studio 2012. Someone posted the custom NinjectControllerFactory code there, so I tried it, and it worked. The error stopped.
If you know a better alternative, please post it.
Fred Chateau
On Friday, January 25, 2013 7:38:22 PM UTC-6, Fred Chateau wrote: