Path: redb-route/redb.Route.As4/Extensions/ServiceCollectionExtensions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.As4/Extensions/ServiceCollectionExtensions.cs
----
using Microsoft.Extensions.DependencyInjection;
using redb.Route.Extensions;
using redb.Route.Http;
namespace redb.Route.As4;
/// Registration of the AS4 transport in a DI container.
public static class ServiceCollectionExtensions
{
///
/// Registers the so that as4: and as4s: URIs resolve, sharing one
/// Kestrel host with every other HTTP-based connector of the process.
///
/// services.AddRedbRoute(route =>
/// {
/// route.Services.AddRedbRouteAs4();
/// route.AddRouteBuilder<MyRoutes>();
/// });
///
///
public static IServiceCollection AddRedbRouteAs4(this IServiceCollection services)
{
services.AddRedbRouteHttpHosting();
services.AddSingleton();
services.AddRouteContextConfigurator((sp, context) =>
{
var component = sp.GetRequiredService();
component.ServerManager = sp.GetRequiredService();
context.AddComponent(component); // registers as4 + as4s, sets Context + Logger
});
return services;
}
}