コード例 #1
0
        public Controller CreateController(UrlInfo urlInfo)
        {
            IWindsorContainer container = ContainerAccessorUtil.ObtainContainer();

            ControllerTree tree = null;

            try
            {
                tree = (ControllerTree)container["rails.controllertree"];
            }
            catch (ComponentNotFoundException)
            {
                throw new RailsException("ControllerTree not found. Check whether RailsFacility is properly configured/registered");
            }

            String key = (String)tree.GetController(urlInfo.Area, urlInfo.Controller);

            if (key == null || key.Length == 0)
            {
                throw new ControllerNotFoundException(urlInfo);
            }

            if (container.Kernel.HasComponent(key))
            {
                return((Controller)container[key]);
            }

            return(null);
        }
コード例 #2
0
        public override void Release(IFilter filter)
        {
            IWindsorContainer container = ContainerAccessorUtil.ObtainContainer();

            container.Release(filter);

            base.Release(filter);
        }
コード例 #3
0
        public override IFilter Create(Type filterType)
        {
            IWindsorContainer container = ContainerAccessorUtil.ObtainContainer();

            if (container.Kernel.HasComponent(filterType))
            {
                return((IFilter)container[filterType]);
            }
            else
            {
                return(base.Create(filterType));
            }
        }
コード例 #4
0
        public ViewComponent Create(String name)
        {
            IWindsorContainer container = ContainerAccessorUtil.ObtainContainer();

            if (container.Kernel.HasComponent(name))
            {
                try
                {
                    return((ViewComponent)container[name]);
                }
                catch (InvalidCastException ex)
                {
                    throw new RailsException("The component registered for the given key could not be casted into a ViewComponent. Key " + name, ex);
                }
            }
            else
            {
                throw new RailsException("No ViewComponent registered in the container for key " + name);
            }
        }
コード例 #5
0
 public void Release(Controller controller)
 {
     ContainerAccessorUtil.ObtainContainer().Release(controller);
 }