- Home
- /
- Foundation
- /
- DMBPageBuilder
- /
- Getting Started
Getting Started — PageBuilder
Install the rendering foundation and wire the body-first page pipeline.
1. Install the NuGet Package
Start here when you want the PageBuilder document lifecycle before adopting BootstrapBuilder, EffectBuilder, ComponentBuilder or DocumentationViewer.
dotnet add package DMBPageBuilder2. Configure Services
Load the common configuration before building the application service provider. This registers the page registry and document pipeline.
using DMBPageBuilder;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
PageBuilderConfiguration.LoadCommonConfig(builder);
builder.Services.AddControllersWithViews();3. Add Razor Imports
Add PageBuilder to _ViewImports.cshtml so views and layouts can create builders and access page state.
@using DMBPageBuilder
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers4. Apply the Layout Pattern
The core pattern captures the body first so components can register page-level assets before the document head is emitted.
@{
var originalWriter = ViewContext.Writer;
var bodyWriter = new StringWriter();
try
{
ViewContext.Writer = bodyWriter;
RenderBody().WriteTo(ViewContext.Writer, HtmlEncoder);
}
finally
{
ViewContext.Writer = originalWriter;
}
var bodyHtml = bodyWriter.ToString();
PageInformation page = PageRegistry.GetPageInformation(Context) ?? new PageInformation();
PageBuilder builder = Html.PageBuilder(page);
}
@builder.RenderDocumentStart(Context)
@Html.Raw(bodyHtml)
@builder.RenderDocumentEnd(Context)Key API
Understand how PageBuilder separates document orchestration from component rendering.
Check out the architecture guide to understand how PageBuilder manages resources and rendering.
Architecture