Franz.Common.Hosting
3.0.0
dotnet add package Franz.Common.Hosting --version 3.0.0
NuGet\Install-Package Franz.Common.Hosting -Version 3.0.0
<PackageReference Include="Franz.Common.Hosting" Version="3.0.0" />
<PackageVersion Include="Franz.Common.Hosting" Version="3.0.0" />
<PackageReference Include="Franz.Common.Hosting" />
paket add Franz.Common.Hosting --version 3.0.0
#r "nuget: Franz.Common.Hosting, 3.0.0"
#:package Franz.Common.Hosting@3.0.0
#addin nuget:?package=Franz.Common.Hosting&version=3.0.0
#tool nuget:?package=Franz.Common.Hosting&version=3.0.0
Franz.Common.Hosting
Ordered asynchronous initialization of scoped application services during host startup.
Overview
Ordered asynchronous initialization of scoped application services during host startup.
Installation
dotnet add package Franz.Common.Hosting
Initializer contract
Implement IHostingInitializer for startup work that must run after the host's service provider is available.
using Franz.Common.Hosting;
public sealed class ReferenceDataInitializer : IHostingInitializer
{
public int Order => 100;
public Task InitializeAsync(CancellationToken cancellationToken = default)
{
// Perform bounded, idempotent initialization.
return Task.CompletedTask;
}
}
The interface inherits IScopedDependency, so implementations participate in the marker-based scoped registration convention when their assemblies are scanned by Franz.Common.DependencyInjection.
Initialization lifecycle
The package provides:
IServiceProvider.InitializeAsync(): creates a scope, resolves allIHostingInitializerimplementations, orders them by ascendingOrder, and awaits them sequentially.IHost.Initialize(): validates the host, invokeshost.Services.InitializeAsync(), then returns the same host instance.
using Franz.Common.Hosting.Extensions;
var host = builder.Build();
await host.Initialize();
await host.RunAsync();
Initialization is sequential, not parallel. The implementation does not pass a cancellation token to each initializer; each initializer receives its optional token through its own contract, but the orchestration method currently invokes the parameterless call. Initializers should therefore be bounded, idempotent where possible, and explicit about their own cancellation and failure behavior.
If an initializer throws, the sequential loop stops and the exception propagates to the caller. The host should not proceed to serving traffic after failed mandatory initialization.
Scope and disposal
All initializers resolved by one call share the created scope. The scope is disposed when initialization completes, including when an initializer fails. Do not retain scoped dependencies beyond this lifecycle.
Registration
Register initializers through the scoped marker scan or explicitly as scoped services. The package does not scan assemblies or automatically invoke initialization merely because the host is built.
License
MIT. See 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
- Franz.Common (>= 3.0.0)
- Franz.Common.DependencyInjection (>= 3.0.0)
- Franz.Common.Reflection (>= 3.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Franz.Common.Hosting:
| Package | Downloads |
|---|---|
|
Franz.Common.Messaging.Hosting
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging.Kafka
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Bootstrap
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging.RabbitMQ
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging.Hosting.RabbitMQ
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 85 | 11/10/2026 |
| 2.3.4 | 472 | 11/1/2026 |
| 2.3.3 | 425 | 10/28/2026 |
| 2.3.2 | 221 | 10/27/2026 |
| 2.3.1 | 282 | 10/26/2026 |
| 2.3.0 | 411 | 7/21/2026 |
| 2.2.19 | 262 | 7/19/2026 |
| 2.2.18 | 270 | 7/19/2026 |
| 2.2.17 | 268 | 7/12/2026 |
| 2.2.16 | 280 | 7/2/2026 |
| 2.2.15 | 266 | 6/29/2026 |
| 2.2.14 | 264 | 6/29/2026 |
| 2.2.13 | 263 | 6/29/2026 |
| 2.2.12 | 262 | 6/28/2026 |
| 2.2.11 | 272 | 6/28/2026 |
| 2.2.10 | 270 | 6/28/2026 |
| 2.2.9 | 272 | 6/28/2026 |
| 2.2.8 | 259 | 6/28/2026 |
| 2.2.7 | 273 | 6/7/2026 |
| 2.2.6 | 268 | 6/6/2026 |