Quantcast
Channel: Unity DI with MVC 5 in controllers - Stack Overflow
Browsing all 5 articles
Browse latest View live

Answer by Bogdan Banciu for Unity DI with MVC 5 in controllers

you can try thispublic class ToolbarControllerContext{ [Dependency] public IToolbarLogic ToolbarLogic { get; set; }}public class ToolbarController : BaseController{ private readonly IToolbarLogic...

View Article



Answer by Sulay Shah for Unity DI with MVC 5 in controllers

The unity config is missing with the mapto registration entry that it will use to resolve the configuration<container><register type="MyService"> ... </register> <!-- Default...

View Article

Answer by Nkosi for Unity DI with MVC 5 in controllers

From the comments in your code it is indicated that there is a unity config file.Calling container.LoadConfiguration(); after configuration in code will override any matching type registration from the...

View Article

Answer by Aboc for Unity DI with MVC 5 in controllers

Try to replace the constructor of your controller by the following:public ToolbarController(IToolbarLogic toolbarLogic){ this.ToolbarLogic = toolbarLogic;}

View Article

Unity DI with MVC 5 in controllers

I'm currently having issues when trying to make a dependency injection inside a MVC controller.The current exception is the following:The current type, myproject.Core.ToolbarLogic, is an interface and...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images