ASP.NET MVC2 Error: No parameterless constructor defined for this object?

You need to configure a custom controller factory in order to wire up your DI framework inside Application_Start method in global.asax. So for example if you are using Unity as DI framework you could: ControllerBuilder.Current. SetControllerFactory( typeof(UnityControllerFactory) ) Check out this blog post for more information.

You need to configure a custom controller factory in order to wire up your DI framework inside Application_Start method in global.asax. So for example if you are using Unity as DI framework you could: ControllerBuilder.Current. SetControllerFactory( typeof(UnityControllerFactory) ); Check out this blog post for more information.

I have this entry already in my Global. Asax file, for using Castle Windsor. ControllerBuilder.Current.

SetControllerFactory(new WindsorControllerFactory()); – Caley Woods Dec 28 '10 at 17:17 @Caley Woods, could you show your code registering the controllers and their dependencies with castle windsor? – Darin Dimitrov Dec 28 '10 at 17:47 I edited my original post, it's at the bottom. – Caley Woods Dec 28 '10 at 18:01 I noticed I don't have a connectionString defined in my components section, any idea how to implement that?

According to the book but I'm not positive what goes between there. – Caley Woods Dec 28 '10 at 18:06.

You can make use of setter based injection public class ProductsController : Controller { private IProductsRepository productsRepository; public ProductsController() { } public ViewResult List() { return View(productsRepository.Products.ToList()); } public IProductsRepository MyRepository { get { return productsRepository; } set { productsRepository = value; } } } here , you need to manually set the MyRepository. But best would be , if you register your repository to a container and beliving that you are using Unity framework , so you can do it by IUnityContainer.RegisterType() method.

You need to configure a custom controller factory in order to wire up your DI framework inside Application_Start method in global.asax. So for example if you are using Unity as DI framework you could.

You can make use of setter based injection.

MissingMethodException: No parameterless constructor defined for this object.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions