Franz.Common.Messaging.MultiTenancy 1.3.1

dotnet add package Franz.Common.Messaging.MultiTenancy --version 1.3.1
                    
NuGet\Install-Package Franz.Common.Messaging.MultiTenancy -Version 1.3.1
                    
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.Messaging.MultiTenancy" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.Messaging.MultiTenancy" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.Messaging.MultiTenancy" />
                    
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.Messaging.MultiTenancy --version 1.3.1
                    
#r "nuget: Franz.Common.Messaging.MultiTenancy, 1.3.1"
                    
#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.Messaging.MultiTenancy@1.3.1
                    
#: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.Messaging.MultiTenancy&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.Messaging.MultiTenancy&version=1.3.1
                    
Install as a Cake Tool

Franz.Common.Messaging.MultiTenancy

A library within the Franz Framework that adds multi-tenancy support to messaging workflows. This package provides tools for managing tenant and domain-specific messaging contexts, enabling seamless integration of multi-tenancy in distributed systems.


Features

  • Tenant Context Management:

    • TenantContextAccessor for handling tenant-specific data in messaging workflows.
  • Domain Context Management:

    • DomainContextAccessor for managing domain-specific information during message processing.
  • Resolvers:

    • HeaderTenantResolver and HeaderDomainResolver for resolving multi-tenancy metadata from message headers.
    • MessagePropertyTenantResolver and MessagePropertyDomainResolver for resolving multi-tenancy metadata from message properties.
  • Resolution Pipelines:

    • DefaultTenantResolutionPipeline and DefaultDomainResolutionPipeline to coordinate multiple resolvers in order.
  • Middleware:

    • TenantResolutionMiddleware and DomainResolutionMiddleware for automatic resolution per message.
  • Service Registration:

    • ServiceCollectionExtensions to simplify the setup of multi-tenancy messaging services.
  • Message Builders:

    • TenantMessageBuilder and DomainMessageBuilder for constructing messages with tenant and domain data.

Version Information

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

Dependencies

This package relies on:

  • Franz.Common.Messaging: Provides foundational messaging utilities and abstractions.
  • Franz.Common.MultiTenancy: Core utilities for tenant and domain management.

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.Messaging.MultiTenancy --Version 1.3.1

Usage

1. Register Multi-Tenancy Messaging Services

Use ServiceCollectionExtensions to register messaging multi-tenancy services:

using Franz.Common.Messaging.MultiTenancy.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddFranzMessagingMultiTenancy();
    }
}

2. Access Tenant and Domain Contexts

Leverage TenantContextAccessor and DomainContextAccessor to retrieve tenant and domain-specific data:

using Franz.Common.Messaging.MultiTenancy;

public class TenantService
{
    private readonly ITenantContextAccessor _tenantContextAccessor;

    public TenantService(ITenantContextAccessor tenantContextAccessor)
    {
        _tenantContextAccessor = tenantContextAccessor;
    }

    public Guid? GetCurrentTenantId() => _tenantContextAccessor.GetCurrentTenantId();
}
using Franz.Common.Messaging.MultiTenancy;

public class DomainService
{
    private readonly IDomainContextAccessor _domainContextAccessor;

    public DomainService(IDomainContextAccessor domainContextAccessor)
    {
        _domainContextAccessor = domainContextAccessor;
    }

    public Guid? GetCurrentDomainId() => _domainContextAccessor.GetCurrentDomainId();
}

3. Automatic Tenant/Domain Resolution in Messaging Pipelines

Enable middleware to resolve tenant and domain per-message:

using Franz.Common.Messaging.MultiTenancy.Middleware;

public class MessagingPipeline
{
    public void Configure(IMessagePipelineBuilder pipeline)
    {
        pipeline.Use<TenantResolutionMiddleware>();
        pipeline.Use<DomainResolutionMiddleware>();
    }
}

4. Build Tenant and Domain Messages

Use TenantMessageBuilder and DomainMessageBuilder to create tenant and domain-aware messages:

using Franz.Common.Messaging.MultiTenancy;

var tenantMessage = new TenantMessageBuilder()
    .WithTenantId(Guid.NewGuid())
    .Build();

var domainMessage = new DomainMessageBuilder()
    .WithDomainId(Guid.NewGuid())
    .Build();

Integration with Franz Framework

The Franz.Common.Messaging.MultiTenancy package integrates seamlessly with:

  • Franz.Common.Messaging: Provides core messaging abstractions.
  • Franz.Common.MultiTenancy: Extends tenant and domain management capabilities into messaging workflows.
  • Franz.Common.Http.MultiTenancy: Aligns messaging and HTTP multi-tenancy under the same abstractions and contracts.

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. @ https://github.com/bestacio89/Franz.Common/
  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.65

  • Added TenantContextAccessor and DomainContextAccessor for managing tenant and domain contexts.
  • Introduced TenantMessageBuilder and DomainMessageBuilder for constructing tenant and domain-aware messages.
  • Integrated ServiceCollectionExtensions for streamlined multi-tenancy messaging setup.

Version 1.3

  • Upgraded to .NET 9.0.8
  • Added new features and improvements
  • Separated business concepts from mediator concepts
  • Now compatible with both the in-house mediator and MediatR

Version 1.3.1

  • Expanded messaging multi-tenancy abstractions to align with HTTP and core multi-tenancy:

    • Added HeaderTenantResolver and HeaderDomainResolver.
    • Added MessagePropertyTenantResolver and MessagePropertyDomainResolver.
    • Introduced DefaultTenantResolutionPipeline and DefaultDomainResolutionPipeline to orchestrate resolvers.
    • Added TenantResolutionMiddleware and DomainResolutionMiddleware for automatic resolution in messaging pipelines.
  • Enhanced TenantContextAccessor and DomainContextAccessor to fully implement the updated core contracts (GetCurrentTenantId, SetCurrentTenantId, etc.).

  • Extended Message with a Properties dictionary for application-level metadata.

  • Added MessagePropertiesExtensions for strongly-typed property access.

  • Improved service registration via AddFranzMessagingMultiTenancy.


Would you like me to also prepare a NuGet-style release notes snippet for version 1.3.1 (short, consumer-facing highlights) so you can publish it with your private feed alongside the README?

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.  net10.0 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on Franz.Common.Messaging.MultiTenancy:

Package Downloads
Franz.Common.Messaging.Bootstrap

Shared utility library for the Franz Framework.

Franz.Common.Http.Messaging

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1 36 9/12/2025
1.3.0 281 8/25/2025
1.2.65 168 3/3/2025
1.2.64 122 1/29/2025
1.2.63 119 1/27/2025
1.2.62 107 1/8/2025