How to register Umbraco RenderMvcControllers in glabal asax
I am trying to use RenderMvcController and SurfaceController with dependency injection but it doesn't work.
public class SupplierRenderMvcController : RenderMvcController
{
public HomeRenderMvcController(IMembershipService membershipService)
{
_membershipService = membershipService;
}
}
public class SupplierController : SurfaceController
{
public SupplierController(IMembershipService membershipService)
{
_membershipService = membershipService;
}
}
It is saying:
No parameterless constructor defined for this object.
Umbraco's controllers are registered in in Global.asax:
public class SupplierRenderMvcController : RenderMvcController
{
public HomeRenderMvcController(IMembershipService membershipService)
{
_membershipService = membershipService;
}
}
Shouldn't the constructor be called SupplierRenderMvcController and not HomeRenderMvcController
You could always add global things such as Output Caching. public virtual ActionResult Index(RenderModel model) a new Global Application class where we can setup Simple Injector and register any interfaces and their implementations. We can do this by editing our global.asax file as follows.
How to register Umbraco RenderMvcControllers in glabal asax
I am trying to use
RenderMvcControllerandSurfaceControllerwith dependency injection but it doesn't work.It is saying:
Umbraco's controllers are registered in in
Global.asax:I have api controllers using IoC with no problem in other projects of the same solution.
The above controlers are in the main project of the solution though.
This is my full
Global.asaxof the main project:MembershipServiceis registered withinWebApiConfig:is the error referring to this
Shouldn't the constructor be called SupplierRenderMvcController and not HomeRenderMvcController
You could always add global things such as Output Caching. public virtual ActionResult Index(RenderModel model) a new Global Application class where we can setup Simple Injector and register any interfaces and their implementations. We can do this by editing our global.asax file as follows.
PupilPath
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.