コード例 #1
0
        /// <exclude />
        public static Control Render(XDocument document, FunctionContextContainer contextContainer, IXElementToControlMapper mapper, IPage page)
        {
            using (TimerProfilerFacade.CreateTimerProfiler())
            {
                using (Profiler.Measure("Executing embedded functions"))
                {
                    ExecuteEmbeddedFunctions(document.Root, contextContainer);
                }

                using (Profiler.Measure("Resolving page fields"))
                {
                    ResolvePageFields(document, page);
                }

                using (Profiler.Measure("Normalizing ASP.NET forms"))
                {
                    NormalizeAspNetForms(document);
                }

                if (document.Root.Name != RenderingElementNames.Html)
                {
                    return(new LiteralControl(document.ToString()));
                }

                var xhtmlDocument = new XhtmlDocument(document);

                ProcessXhtmlDocument(xhtmlDocument, page);

                using (Profiler.Measure("Converting XHTML document into an ASP.NET control"))
                {
                    return(xhtmlDocument.AsAspNetControl(mapper));
                }
            }
        }
コード例 #2
0
        /// <exclude />
        public static Control Render(XDocument document, FunctionContextContainer contextContainer, IXElementToControlMapper mapper, IPage page)
        {
            using (TimerProfilerFacade.CreateTimerProfiler())
            {
                ExecuteEmbeddedFunctions(document.Root, contextContainer);

                ResolvePageFields(document, page);

                NormalizeAspNetForms(document);

                if (document.Root.Name != Namespaces.Xhtml + "html")
                {
                    return(new LiteralControl(document.ToString()));
                }

                XhtmlDocument xhtmlDocument = new XhtmlDocument(document);
                NormalizeXhtmlDocument(xhtmlDocument);

                ResolveRelativePaths(xhtmlDocument);

                PrioritizeHeadNodex(xhtmlDocument);

                AppendC1MetaTags(page, xhtmlDocument);

                LocalizationParser.Parse(xhtmlDocument);

                return(xhtmlDocument.AsAspNetControl(mapper));
            }
        }
コード例 #3
0
        /// <exclude />
        public static Control Render(XDocument document, FunctionContextContainer contextContainer, IXElementToControlMapper mapper, IPage page)
        {
            using (TimerProfilerFacade.CreateTimerProfiler())
            {
                bool disableCaching = false;

                using (Profiler.Measure("Executing embedded functions"))
                {
                    ExecuteFunctionsRec(document.Root, contextContainer, func =>
                    {
                        if (!disableCaching && !FunctionAllowsCaching(func))
                        {
                            disableCaching = true;
                        }

                        return(true);
                    });
                }

                if (disableCaching)
                {
                    using (Profiler.Measure("PageRenderer: Disabling HTTP caching as at least one of the functions is not cacheable"))
                    {
                        HttpContext.Current?.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    }
                }

                using (Profiler.Measure("Resolving page fields"))
                {
                    ResolvePageFields(document, page);
                }

                using (Profiler.Measure("Normalizing ASP.NET forms"))
                {
                    NormalizeAspNetForms(document);
                }

                if (document.Root.Name != RenderingElementNames.Html)
                {
                    return(new LiteralControl(document.ToString()));
                }

                var xhtmlDocument = new XhtmlDocument(document);

                ProcessXhtmlDocument(xhtmlDocument, page);

                using (Profiler.Measure("Converting XHTML document into an ASP.NET control"))
                {
                    return(xhtmlDocument.AsAspNetControl(mapper));
                }
            }
        }
コード例 #4
0
        /// <exclude />
        public static Control Render(XDocument document, FunctionContextContainer contextContainer, IXElementToControlMapper mapper, IPage page)
        {
            using (TimerProfilerFacade.CreateTimerProfiler())
            {
                ProcessPageDocument(document, contextContainer, page);

                if (document.Root.Name != RenderingElementNames.Html)
                {
                    return(new LiteralControl(document.ToString()));
                }

                var xhtmlDocument = new XhtmlDocument(document);

                ProcessXhtmlDocument(xhtmlDocument, page);

                using (Profiler.Measure("Converting XHTML document into an ASP.NET control"))
                {
                    return(xhtmlDocument.AsAspNetControl(mapper));
                }
            }
        }
コード例 #5
0
 /// <exclude />
 public static Control AsAspNetControl(this XhtmlDocument xhtmlDocument)
 {
     return(xhtmlDocument.AsAspNetControl(NoMappingMapper.GetInstance()));
 }