// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Microsoft.AspNet.PageExecutionInstrumentation; namespace Microsoft.AspNet.Mvc.Razor { /// /// Represents properties and methods that are used by for execution. /// public interface IRazorPage { /// /// Gets or sets the view context of the renderign view. /// ViewContext ViewContext { get; set; } /// /// Gets or sets the action invoked to render the body. /// Func RenderBodyDelegateAsync { get; set; } /// /// Gets or sets a flag that determines if the layout of this page is being rendered. /// /// /// Sections defined in a page are deferred and executed as part of the layout page. /// When this flag is set, all write operations performed by the page are part of a /// section being rendered. /// bool IsLayoutBeingRendered { get; set; } /// /// Gets the application base relative path to the page. /// string Path { get; set; } /// /// Gets or sets the path of a layout page. /// string Layout { get; set; } /// /// Gets or sets a value that determines if the current instance of is being executed /// from a partial view. /// bool IsPartial { get; set; } /// /// Gets or sets a instance used to instrument the page execution. /// IPageExecutionContext PageExecutionContext { get; set; } /// /// Gets or sets the sections that can be rendered by this page. /// IDictionary PreviousSectionWriters { get; set; } /// /// Gets the sections that are defined by this page. /// IDictionary SectionWriters { get; } /// /// Renders the page and writes the output to the . /// /// A task representing the result of executing the page. Task ExecuteAsync(); /// /// Verifies that all sections defined in were rendered, or /// the body was rendered if no sections were defined. /// /// if one or more sections were not rendered or if no sections were /// defined and the body was not rendered. void EnsureRenderedBodyOrSections(); } }