示例#1
0
        private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
        {
            page.IsPartial   = IsPartial;
            page.ViewContext = context;

            await page.ExecuteAsync();
        }
示例#2
0
        private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
        {
            page.IsPartial   = IsPartial;
            page.ViewContext = context;
            if (EnableInstrumentation)
            {
                page.PageExecutionContext = _pageExecutionFeature.GetContext(page.Path, context.Writer);
            }

            _pageActivator.Activate(page, context);
            await page.ExecuteAsync();
        }
示例#3
0
        private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
        {
            page.ViewContext = context;
            _pageActivator.Activate(page, context);

            _diagnosticSource.BeforeViewPage(page, context);

            try
            {
                await page.ExecuteAsync();
            }
            finally
            {
                _diagnosticSource.AfterViewPage(page, context);
            }
        }
        async Task <ViewBufferTextWriter> RenderPageAsync(IViewBufferScope bufferScope, IRazorPage page, ViewRenderingContext viewRenderingContext)
        {
            var writer = viewRenderingContext.Writer as ViewBufferTextWriter;

            if (writer == null)
            {
                // If we get here, this is likely the top-level page (not a partial) - this means
                // that context.Writer is wrapping the output stream. We need to buffer, so create a buffered writer.
                var buffer = new ViewBuffer(bufferScope, page.GetType().AssemblyQualifiedName, ViewBuffer.ViewPageSize);
                writer = new ViewBufferTextWriter(buffer, viewRenderingContext.Writer.Encoding, this.htmlEncoder, viewRenderingContext.Writer);
            }
            else
            {
                // This means we're writing something like a partial, where the output needs to be buffered.
                // Create a new buffer, but without the ability to flush.
                var buffer = new ViewBuffer(bufferScope, page.GetType().AssemblyQualifiedName, ViewBuffer.ViewPageSize);
                writer = new ViewBufferTextWriter(buffer, viewRenderingContext.Writer.Encoding);
            }

            // The writer for the body is passed through the ViewContext, allowing things like HtmlHelpers
            // and ViewComponents to reference it.
            var oldWriter = viewRenderingContext.Writer;

            //var oldFilePath = context.ExecutingFilePath;

            viewRenderingContext.Writer = writer;
            //context.ExecutingFilePath = page.Path;

            try
            {
                page.RenderingContext = viewRenderingContext;
                await page.ExecuteAsync();

                return(writer);
            }
            finally
            {
                viewRenderingContext.Writer = oldWriter;
                //context.ExecutingFilePath = oldFilePath;
            }
        }
示例#5
0
 private Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
 {
     page.ViewContext = context;
     _pageActivator.Activate(page, context);
     return page.ExecuteAsync();
 }
示例#6
0
        private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
        {
            page.IsPartial = IsPartial;
            page.ViewContext = context;

            await page.ExecuteAsync();
        }
示例#7
0
 private async Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
 {
     page.ViewContext = context;
     _pageActivator.Activate(page, context);
     await page.ExecuteAsync();
 }
示例#8
0
        private Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
        {
            page.IsPartial = IsPartial;
            page.ViewContext = context;
            if (EnableInstrumentation)
            {
                page.PageExecutionContext = _pageExecutionFeature.GetContext(page.Path, context.Writer);
            }

            _pageActivator.Activate(page, context);
            return page.ExecuteAsync();
        }
示例#9
0
 private Task RenderPageCoreAsync(IRazorPage page, ViewContext context)
 {
     page.ViewContext = context;
     _pageActivator.Activate(page, context);
     return(page.ExecuteAsync());
 }