示例#1
0
        /// <summary>
        ///     Creates new descriptor over given action
        /// </summary>
        /// <param name="render"> </param>
        public RenderDescriptor(IRender render)
        {
            Render     = render;
            Name       = RenderAttribute.GetName(render);
            DirectRole = RenderAttribute.GetRole(render);
            var contextualRender = render as IContextualRender;

            if (contextualRender != null)
            {
                contextualRender.SetDescriptor(this);
            }
        }
示例#2
0
        private void RegisterRender(Type type)
        {
            var name      = NormalizeRenderName(RenderAttribute.GetName(type));
            var component = Container.EmptyComponent();

            component.Name               = name;
            component.ServiceType        = typeof(IRender);
            component.ImplementationType = type;
            component.Lifestyle          = Lifestyle.Transient;
            Container.Register(component);
            ClearCaches(MvcObjectType.Render, name);
        }