PenningtonExtensions Pennington.Infrastructure
DI and pipeline extensions that wire Pennington services into an ASP.NET Core host.
Methods
AddPennington
#public static IServiceCollection AddPennington(this IServiceCollection services, Action<PenningtonOptions> configure);Register all Pennington services.
Parameters
servicesIServiceCollectionconfigureAction<PenningtonOptions>
Returns
IServiceCollectionRunOrBuildAsync
#public static async Task RunOrBuildAsync(this WebApplication app, string[] args);Run in dev mode or build static site.
Parameters
appWebApplicationargsstring[]
Returns
TaskUsePennington
#public static WebApplication UsePennington(this WebApplication app);Configure the Pennington middleware pipeline.
Parameters
appWebApplication
Returns
WebApplicationUsePenningtonLocaleRouting
#public static WebApplication UsePenningtonLocaleRouting(this 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
appWebApplication
Returns
WebApplicationPennington.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(this IServiceCollection services, Action<PenningtonOptions> configure);
/// Run in dev mode or build static site.
public static async Task RunOrBuildAsync(this WebApplication app, string[] args);
/// Configure the Pennington middleware pipeline.
public static WebApplication UsePennington(this 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.
public static WebApplication UsePenningtonLocaleRouting(this WebApplication app);
}