I've got Unity.AspNet.WebApi through NuGet into my Asp.Net WebApi application and all my controllers are able to resolve classes through constructor injection. Easy and simple.
However I am not sure on how to resolve classes in global.asax as I don't have direct access to UnityContainer here. I've tried below and it seems to be working. Is there a better way?
Also, as this is start up code not sure if this clashes with the WebActivator which registers UnityContainer. I am concerned that whether there woould be always a Dependencyresolver ready in Application_Start() method.
var o = GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(IService));
var service = (IService)o;
serviceInitializePermissionsCache();
Answering my own question: