Exemplo n.º 1
0
 /// <summary>
 /// Enriches the renderer.
 /// </summary>
 /// <param name="renderer">The renderer.</param>
 private void EnrichRenderer(ComponentRenderer <TComponent> renderer)
 {
     renderer.Component   = Component;
     renderer.HtmlHelper  = HtmlHelper;
     renderer.ViewContext = HtmlHelper.ViewContext;
     renderer.ViewData    = HtmlHelper.ViewData;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Withes the renderer.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="instance">The instance.</param>
        /// <returns>TBuilder.</returns>
        public TBuilder WithRenderer <T>(ComponentRenderer <TComponent> instance)
            where T : ComponentRenderer <TComponent>
        {
            Guard.NotNull(instance, nameof(instance));

            Renderer = instance;
            return(this as TBuilder);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Withes the renderer.
        /// </summary>
        /// <param name="rendererType">Type of the renderer.</param>
        /// <returns>TBuilder.</returns>
        public TBuilder WithRenderer(Type rendererType)
        {
            Guard.NotNull(rendererType, nameof(rendererType));
            Guard.Implements <ComponentRenderer <TComponent> >(rendererType);

            var renderer = Activator.CreateInstance(rendererType) as ComponentRenderer <TComponent>;

            if (renderer != null)
            {
                Renderer = renderer;
            }

            return(this as TBuilder);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Withes the renderer.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <returns>TBuilder.</returns>
        public TBuilder WithRenderer(ComponentRenderer <TComponent> instance)
        {
            Guard.NotNull(instance, nameof(instance));

            return(WithRenderer <ComponentRenderer <TComponent> >(instance));
        }