Euhen.AppBuilder.Web
2.1.0
dotnet add package Euhen.AppBuilder.Web --version 2.1.0
NuGet\Install-Package Euhen.AppBuilder.Web -Version 2.1.0
<PackageReference Include="Euhen.AppBuilder.Web" Version="2.1.0" />
<PackageVersion Include="Euhen.AppBuilder.Web" Version="2.1.0" />
<PackageReference Include="Euhen.AppBuilder.Web" />
paket add Euhen.AppBuilder.Web --version 2.1.0
#r "nuget: Euhen.AppBuilder.Web, 2.1.0"
#:package Euhen.AppBuilder.Web@2.1.0
#addin nuget:?package=Euhen.AppBuilder.Web&version=2.1.0
#tool nuget:?package=Euhen.AppBuilder.Web&version=2.1.0
Euhen.AppBuilder.Web
ASP.NET Core extension package for building modular web applications. Extends Euhen.AppBuilder with support for middleware pipeline configuration via pipeline modules.
Installation
dotnet add package Euhen.AppBuilder.Web
How it works
EuhenWebAppBuilder extends EuhenAppBuilder with pipeline module support. It wraps WebApplicationBuilder and coordinates both service registration and middleware pipeline configuration. Service modules are applied immediately upon registration. Pipeline modules are queued and applied in registration order when Build() is called, after the WebApplication has been constructed.
Getting started
Step 1 — Create a module
The recommended approach is to implement IModule, which combines both IServiceModule and IPipelineModule. This allows you to group all configuration logic for a feature — services and pipeline — in a single class.
using Euhen.AppBuilder.Web.Modules;
public class AuthModule : IModule
{
public void Configure(IHostApplicationBuilder builder)
{
builder.Services.AddAuthentication();
builder.Services.AddAuthorization();
}
public void Configure(WebApplication app)
{
app.UseAuthentication();
app.UseAuthorization();
}
}
When a feature only involves service registration and no pipeline configuration, implement IServiceModule from Euhen.AppBuilder and use AddServiceModule instead.
When a feature only involves pipeline configuration, implement IPipelineModule and use AddPipelineModule.
Step 2 — Register the module in Program.cs
Use EuhenWebAppBuilder and register your modules with AddModule. Call Build() to finalise the application.
You can construct EuhenWebAppBuilder in two ways:
- Pass
argsdirectly —argsis the variable automatically available inProgram.csthat contains the command-line arguments passed to the application.EuhenWebAppBuilderwill create theWebApplicationBuilderinternally. - Pass an existing
WebApplicationBuilderorIHostApplicationBuilder.
var app = new EuhenWebAppBuilder(args)
.AddModule(new AuthModule())
.Build();
app.Run();
When custom configuration is needed outside of a module, use ConfigureServices and ConfigurePipelines to apply inline configuration directly:
var app = new EuhenWebAppBuilder(args)
.AddModule(new AuthModule())
.ConfigureServices(b => b.Services.AddControllers())
.ConfigurePipelines(a => a.MapControllers())
.Build();
app.Run();
Terminology
| Term | Description |
|---|---|
EuhenWebAppBuilder |
Extends EuhenAppBuilder with pipeline module support. Wraps WebApplicationBuilder and exposes Build(). |
IServiceModule |
Contract for a module that registers services into the DI container. Configure is called immediately when the module is added. Defined in Euhen.AppBuilder. |
IPipelineModule |
Contract for a module that configures the ASP.NET Core middleware pipeline. Configure is called in Build(), after WebApplication has been constructed. |
IModule |
Combines IServiceModule and IPipelineModule. The preferred way to define a web feature module. |
AddModule |
Registers an IModule: immediately applies service configuration and queues pipeline configuration for Build(). |
AddServiceModule |
Registers and immediately applies an IServiceModule without pipeline configuration. |
AddPipelineModule |
Queues an IPipelineModule to be applied during Build(). |
Build() |
Finalises the WebApplicationBuilder, applies all registered pipeline modules in order, and returns the configured WebApplication. |
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Euhen.AppBuilder (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.