Given a webApi controller like this:
public class MapsController : OwinApiController
{
private readonly IStorageAccountCache _mapCache;
public MapsController(IStorageAccountCache mapCache)
{
this._mapCache = mapCache;
this._mapCache = Configuration.DependencyResolver.GetService(typeof(IStorageAccountCache)) as IStorageAccountCache
}
}
Is ther any different to accessing the dependency resolver by the Configuration instead of getting the value from constructor?
Reason of interest is that given a fairly large controller with alot of dependencies and many action that only uses a subset of these i was considering if using the Configuration.DependencyResolver.GetService in those actions where the dependency is only needed in specific action.
Also, if doing Configuration.DependencyResolver.GetService, has it already called the begin scope according to constructing the controller or should I do a begin scope first.