public object GetService(ServiceRequest request) { var service = _innerResolver.GetService(request); _lifecycle?.GetTracker(request)?.Track(service as IDisposable); return(service); }
public static TService GetService <TService>(this IResolver resolver) { if (resolver == null) { throw new CerseilException("The IResolver parameter cannot be null!"); } return((TService)resolver.GetService(typeof(TService))); }
public object GetService(ServiceRequest request) { var cache = _lifecycle.GetCache(request); if (cache != null) { var service = cache.Retrieve(_key); if (service == null) { service = _innerResolver.GetService(request); cache.Store(_key, service); } return(service); } else { return(_innerResolver.GetService(request)); } }
public object GetService(ServiceRequest request) { Func <TService> service = () => (TService)_innerResolver.GetService(request); var interceptorRequest = request.CreateDependencyRequest (typeof(IEnumerable <IInterceptor <TService> >)); var interceptors = (IEnumerable <IInterceptor <TService> >) request.Container.GetService(interceptorRequest); foreach (var interceptor in interceptors) { var innerService = service; service = () => interceptor.Intercept(request, innerService); } return(service()); }
public object GetService(ServiceRequest request) => _innerResolver.GetService(request);