Franz.Common.Hosting 1.2.62

dotnet add package Franz.Common.Hosting --version 1.2.62                
NuGet\Install-Package Franz.Common.Hosting -Version 1.2.62                
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="1.2.62" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Franz.Common.Hosting --version 1.2.62                
#r "nuget: Franz.Common.Hosting, 1.2.62"                
#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.
// Install Franz.Common.Hosting as a Cake Addin
#addin nuget:?package=Franz.Common.Hosting&version=1.2.62

// Install Franz.Common.Hosting as a Cake Tool
#tool nuget:?package=Franz.Common.Hosting&version=1.2.62                

Franz.Common.Hosting

A utility library within the Franz Framework designed to simplify and enhance hosting configurations for .NET applications. This package provides powerful extensions for working with hosts and service providers, offering flexibility and consistency in application startup and lifecycle management.


Features

  • Host Utilities:
    • HostExtensions for managing and customizing host configurations.
  • Service Provider Extensions:
    • ServiceProviderExtensions for streamlined service resolution and initialization.
  • Hosting Initialization:
    • IHostingInitializer interface to define and manage hosting initialization logic.
  • Compatibility:
    • Integrates seamlessly with Franz.Common, Franz.Common.DependencyInjection, and Franz.Common.Reflection.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • Microsoft.Extensions.Hosting.Abstractions (8.0.0): Core hosting abstractions for building and running .NET applications.
  • Franz.Common: Provides core utilities and shared functionality.
  • Franz.Common.DependencyInjection: Simplifies dependency injection patterns.
  • Franz.Common.Reflection: Offers advanced reflection utilities for host configuration and initialization.

Installation

From Private Azure Feed

Since this package is hosted privately, configure your NuGet client:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Install the package:

dotnet add package Franz.Common.Hosting --version 1.2.62

Usage

1. Customize Host Configuration

Use HostExtensions to configure the host:

using Franz.Common.Hosting.Extensions;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((context, services) =>
    {
        // Register services here
    })
    .UseCustomConfiguration() // Custom extension method for host configuration
    .Build();

await host.RunAsync();

2. Service Resolution

Use ServiceProviderExtensions to resolve and manage services dynamically:

using Franz.Common.Hosting.Extensions;

var service = host.Services.GetRequiredServiceWithLogging<IMyService>();
service.Execute();

3. Hosting Initialization

Implement the IHostingInitializer interface for initializing hosting environments:

using Franz.Common.Hosting;

public class MyHostingInitializer : IHostingInitializer
{
    public void Initialize(IHostBuilder hostBuilder)
    {
        hostBuilder.ConfigureServices((context, services) =>
        {
            services.AddSingleton<IMyService, MyService>();
        });
    }
}

Register the initializer during application startup:

hostBuilder.UseHostingInitializer<MyHostingInitializer>();

Integration with Franz Framework

The Franz.Common.Hosting package integrates seamlessly with:

  • Franz.Common: Provides foundational utilities.
  • Franz.Common.DependencyInjection: Simplifies dependency injection setup.
  • Franz.Common.Reflection: Enables dynamic discovery and registration of services and initializers.

Ensure these dependencies are installed to leverage the full capabilities of the library.


Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository.
  2. Create a feature branch.
  3. Submit a pull request for review.

License

This library is licensed under the MIT License. See the LICENSE file for more details.


Changelog

Version 1.2.62

  • Added HostExtensions for managing host configurations.
  • Introduced ServiceProviderExtensions for dynamic service resolution.
  • Implemented IHostingInitializer for custom hosting initialization logic.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 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.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.62 66 1/8/2025