internal void CreateViewComponent() { if ((viewComponentName == null) || (viewComponentName.Length < 1)) { throw new RailsException("You must specify the component name with 'blockcomponent' and 'component'."); } viewComponent = ((ViewComponentStringTemplateGroup)group).ViewComponentFactory.Create(viewComponentName); viewComponentContext = new StringTemplateViewContextAdapter(viewComponentName, this); }
public override void Release(ViewComponent instance) { if (kernel.HasComponent(instance.GetType())) { kernel.ReleaseComponent(instance); } else { base.Release(instance); } }
/// <summary> /// Initialize the view component with mock services it needs to /// be functional. /// </summary> /// <param name="component">The component instance.</param> protected void PrepareViewComponent(ViewComponent component) { if (Context == null) { BuildEngineContext("", "Controller", "Action"); } viewEngine = BuildViewEngine(); componentContext = BuildViewComponentContext(component.GetType().Name); component.Init(Context, componentContext); }
protected virtual void ProcessSubSections(ViewComponent component, NVelocityViewContextAdapter contextAdapter) { }
public ViewComponentInfo(ViewComponent component) { Type = component.GetType(); Details = Type.GetCustomAttributes(typeof(ViewComponentDetailsAttribute), false).OfType<ViewComponentDetailsAttribute>().FirstOrDefault(); Instance = component; }