public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
        {
            IHttpController instance =
                ControllersHelper.IsUmbracoController(controllerType)
                  ? this._defaultHttpControllerActivator.Create(request, controllerDescriptor, controllerType)
                  : StructuremapMvc.StructureMapDependencyScope.GetInstance(controllerType) as IHttpController;

            return(instance);
        }
Пример #2
0
        protected override object DoGetInstance(Type serviceType, string key)
        {
            IContainer container = (CurrentNestedContainer ?? Container);

            if (ControllersHelper.IsUmbracoController(serviceType))
            {
                return(Activator.CreateInstance(serviceType) as IHttpController);
            }
            if (string.IsNullOrEmpty(key))
            {
                return(serviceType.IsAbstract || serviceType.IsInterface
                   ? container.TryGetInstance(serviceType)
                   : container.GetInstance(serviceType));
            }
            return(container.GetInstance(serviceType, key));
        }