public async Task InvokeAsync(HttpContext context, RequestDelegate next) { var flexiblePage = new FlexiblePageModel { Sections = _siteRequest.Current.PageTemplate.Sections.Select(a => new SectionPartModel { Name = a.ThemePartRef, BindingType = a.BindingType, TemplateKey = a.Key }).ToList(), GoogleMetadata = _siteRequest.Current.Page.GoogleMetadata }; _logger.Info("The current flexible page {@flexiblePage}", flexiblePage); var pageVersion = _siteRequest.Current.PageVersion; if (flexiblePage.Sections != null && flexiblePage.Sections.Any()) { foreach (var section in flexiblePage.Sections) { if (section.BindingType == BindingType.Datasource) { var foundPartVersion = pageVersion.Manifests.FirstOrDefault(a => a.TemplateKey == section.TemplateKey); if (foundPartVersion != null) { section.DatasourceName = foundPartVersion.DatasourceKey; } } } } _siteRequest.Current.RenderedPageModel = flexiblePage; await next.Invoke(context); }
public void OnGet() { RenderPage = _siteRequestAccessor.Current.RenderedPageModel; }