public BoxModelPositionedRenderingController( BoxModelGuidePost guidepost, IRenderingController renderingController, int containerPriority) : base(guidepost ?? BoxModelGuidePost.Center, renderingController, containerPriority) { }
/// <summary> /// This method is used for rendering a child controller that probably does have a ViewModel. /// </summary> /// <param name="containerId">The Id of the container where the view will be displayed.</param> /// <param name="priority">The order of the view in the container.</param> /// <param name="renderingController">The delegate that should probably return a view result.</param> /// <returns>The controller that will be rendered.</returns> protected IPositionedRenderingController CreateRenderingController( int containerId, int priority, IRenderingController renderingController) { return(Controller.CreatePositionedRenderingController(containerId, priority, renderingController)); }
private IResult ExecuteRenderingController( IHttpContext httpContext, IRenderingController renderingController, Expression <Func <IRenderingController, IHttpContext, List <PositionedResult>, IResult> > expression) { this.ExecuteNonRenderingControllers(httpContext, renderingController.NonRenderingControllers); List <PositionedResult> childResults = new List <PositionedResult>(); foreach (var subRenderingController in renderingController.RenderingControllers.Coalesce()) { var subResult = this.ExecuteRenderingController(httpContext, subRenderingController.RenderingController, null); var pr = new PositionedResult { Container = subRenderingController.Container, ContainerPriority = subRenderingController.ContainerPriority, Result = new SimpleResult { Content = subResult.Content }, }; childResults.Add(pr); } if (expression != null) { return(expression.Compile().Invoke(renderingController, httpContext, childResults)); } return(renderingController.Execute(httpContext, childResults)); }
public IResult ExecuteController(IHttpContext httpContext) { var findRenderingControllerType = this.router.FindRenderingControllerType(httpContext.Request); if (findRenderingControllerType == null) { return(application.OnControllerNotFound(httpContext)); } var findNonRenderingControllerTypes = this.router.FindNonRenderingControllerTypes(httpContext.Request); IClass <IRenderingController> renderingControllerClass = findRenderingControllerType.ControllerClass; if (renderingControllerClass == null) { return(application.OnControllerNotFound(httpContext)); } IRenderingController mainController = application.CreateInstance(renderingControllerClass, application.Mode == ApplicationMode.Prod); if (mainController == null) { return(application.OnControllerNotFound(httpContext)); } INonRenderingController[] nonRenderingControllers = findNonRenderingControllerTypes .Where(x => x != null) .Select(x => application.CreateInstance(x.ControllerClass, true)) .ToArray(); this.ExecuteNonRenderingControllers(httpContext, nonRenderingControllers); return(this.ExecuteRenderingController(httpContext, mainController, findRenderingControllerType.Expression)); }
public GuidedPositionedRenderingController( TGuidepost guidepost, IRenderingController renderingController, int containerPriority) { renderingController.Validate().IsNotNull(); this.Guidepost = guidepost; this.RenderingController = renderingController; this.ContainerPriority = containerPriority; }
public static IPositionedRenderingController CreatePositionedRenderingController( int containerId, int priority, IRenderingController renderingController) { return(new PositionedRenderingController { RenderingController = renderingController ?? new NullRenderingController(), Container = containerId, ContainerPriority = priority }); }