Exemple #1
0
        void RenderViewImpl(ViewContext viewContext, Func <XcstTemplateEvaluator, XcstOutputter> getOutputter, object instance)
        {
            if (viewContext is null)
            {
                throw new ArgumentNullException(nameof(viewContext));
            }
            if (instance is null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            XcstViewPage viewPage = instance as XcstViewPage
                                    ?? throw new InvalidOperationException($"The view at '{ViewPath}' must derive from {nameof(XcstViewPage)}, or {nameof(XcstViewPage)}<TModel>.");

            viewPage.ViewContext = viewContext;

            AddFileDependencies(instance, viewContext.HttpContext.Response);

            XcstEvaluator evaluator = XcstEvaluator.Using((object)viewPage);

            foreach (var item in viewContext.ViewData)
            {
                evaluator.WithParam(item.Key, item.Value);
            }

            getOutputter(evaluator.CallInitialTemplate())
            .Run();
        }
 RenderViewPage(XcstViewPage page, HttpContext context) =>
 base.RenderPage(page, context);
 XcstViewPageHandler(XcstViewPage page)
     : base(page)
 {
     _page = page;
 }
Exemple #4
0
 protected virtual void RenderViewPage(XcstViewPage page, HttpContextBase context) =>
 base.RenderPage(page, context);