12345678910111213141516171819202122232425262728293031 |
- using AspNetCoreDefaultHost.Configs;
- using AspNetCoreSsrTemplateEngine.DataBoundContext;
- using Microsoft.AspNetCore.Http;
- using System.Threading.Tasks;
- namespace AspNetCoreDefaultHost.Pages.Basic
- {
- public abstract class PageBase : ComponentBase, IPage
- {
- protected virtual IReadonlyDataBindContext PageDataBindContext { get; set; } = HostConfig.RootDataBindContext;
- protected virtual ComponentBase MasterPage { get; set; }
- public virtual async Task ProcessRequestAsync(HttpContext context)
- {
- context.Response.ContentType = "text/html";
- PreRender();
- if (null != MasterPage) await MasterPage.RenderAsync(PageDataBindContext, context.Response.Body);
- else await RenderAsync(PageDataBindContext, context.Response.Body);
- PostRender();
- }
- protected virtual void PreRender()
- {
- }
- protected virtual void PostRender()
- {
- }
- }
- }
|