This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

PenningtonExtensions Pennington.Infrastructure

DI and pipeline extensions that wire Pennington services into an ASP.NET Core host.

Methods

AddPennington

#
public static IServiceCollection AddPennington(IServiceCollection services, Action<PenningtonOptions> configure)

Register all Pennington services.

Parameters

services IServiceCollection
configure Action<PenningtonOptions>

Returns

IServiceCollection

AddYamlContext

#
public static IServiceCollection AddYamlContext(IServiceCollection services, YamlSerializerContext context)

Register a source-generated YamlSerializerContext so the types it covers deserialize without reflection (NativeAOT/trim-friendly). Types not covered by any registered context fall back to reflection. Satellite templates call this for their own front-matter records; end users call it for theirs.

Parameters

services IServiceCollection
context YamlSerializerContext

Returns

IServiceCollection

RunOrBuildAsync

#
public static Task RunOrBuildAsync(WebApplication app, string[] args)

Runs the host: serves live (no verb), builds the static site (build), or runs a diagnostic command (diag <sub>). Everything flows through one System.CommandLine pipeline, so --help / --version work at the root and every subcommand. Build and diag run one-shot against a started in-memory host that is disposed afterward; serve hands off to RunAsync.

Parameters

app WebApplication
args string[]

Returns

Task

UseLocaleRouting

#
public static WebApplication UseLocaleRouting(WebApplication app)

Adds locale detection and URL path rewriting middleware. Must be called MapRazorComponents so that Blazor routing sees the locale-stripped path (e.g., /gen-z/schedule becomes /schedule).

Called automatically by UsePennington when it hasn't been called yet, but at that point it is too late for Blazor endpoint routing. Sites that use @page directives with locale prefixes must call this explicitly.

Parameters

app WebApplication

Returns

WebApplication

UsePennington

#
public static WebApplication UsePennington(WebApplication app)

Configure the Pennington middleware pipeline.

Parameters

app WebApplication

Returns

WebApplication

Pennington.Infrastructure.PenningtonExtensions

namespace Pennington.Infrastructure;

/// DI and pipeline extensions that wire Pennington services into an ASP.NET Core host.
public class PenningtonExtensions
{
    /// Register all Pennington services.
    
public static IServiceCollection AddPennington(IServiceCollection services, Action<PenningtonOptions> configure)
; /// Register a source-generated YamlSerializerContext so the types it covers deserialize without reflection (NativeAOT/trim-friendly). Types not covered by any registered context fall back to reflection. Satellite templates call this for their own front-matter records; end users call it for theirs.
public static IServiceCollection AddYamlContext(IServiceCollection services, YamlSerializerContext context)
; /// Runs the host: serves live (no verb), builds the static site (build), or runs a diagnostic command (diag <sub>). Everything flows through one System.CommandLine pipeline, so --help / --version work at the root and every subcommand. Build and diag run one-shot against a started in-memory host that is disposed afterward; serve hands off to RunAsync.
public static Task RunOrBuildAsync(WebApplication app, string[] args)
; /// Adds locale detection and URL path rewriting middleware. Must be called MapRazorComponents so that Blazor routing sees the locale-stripped path (e.g., /gen-z/schedule becomes /schedule). Called automatically by UsePennington when it hasn't been called yet, but at that point it is too late for Blazor endpoint routing. Sites that use @page directives with locale prefixes must call this explicitly.
public static WebApplication UseLocaleRouting(WebApplication app)
; /// Configure the Pennington middleware pipeline.
public static WebApplication UsePennington(WebApplication app)
; }