I am using Unity.Mvc4 in asp.net MVC 4 and have built-in Bootstrapper file to register all types like below.
public static class Bootstrapper
{
public static IUnityContainer Initialise()
{
var container = BuildUnityContainer();
DependencyResolver.SetResolver(new UnityDependencyResolver(container));
return container;
}
-----------------------
------------------------
In my Controller constructor, I am injecting IUnityContainer itself for calling Resolve() on demand, like below
private IQuestionBusinessLogic _qstnBL;
public MyController(IUnityContainer unityContainer)
: base(unityContainer)
{
qstnBL = _unityContainer.Resolve<IQuestionBusinessLogic>();
}
Queries are
- Is there any performance burden by injecting IUnityContainer unityContainer itself?
- Is there any other way to call Resolve() than access the IUnityContainer unityContainer this way?
- Make a call to Resolve() it self has any performance burden?