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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Franz.Common.Hosting" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.Hosting" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Franz.Common.Hosting --version 3.0.0
                    
#r "nuget: Franz.Common.Hosting, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Franz.Common.Hosting@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Franz.Common.Hosting&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.Hosting&version=3.0.0
                    
Install as a Cake Tool

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 all IHostingInitializer implementations, orders them by ascending Order, and awaits them sequentially.
  • IHost.Initialize(): validates the host, invokes host.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed