Cosmos.MultiTenancy.CritterStack 3.0.0

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

Cosmos.MultiTenancy.CritterStack

Contexto de tenancy compuesto para servicios que combinan HTTP y daemon de Wolverine (inbox/outbox) en el mismo proceso.

Descripcion

Cosmos.MultiTenancy.AspNetCore provee TrustedHeadersTenantContext, que lee la identidad de headers HTTP. Funciona perfecto en el flujo HTTP, pero falla en handlers ejecutados por el daemon de Wolverine porque ahi no existe HttpContext.

Este paquete completa el cuadro:

  • WolverineMessageTenantContext lee el TenantId desde IMessageContext.TenantId, hidratado automaticamente por Wolverine a partir del envelope entrante. El UserId y el OrganizationMembershipId se leen de los headers user_id y organization_membership_id del envelope, adjuntados por los senders de Cosmos.EventDriven.CritterStack (Wolverine no los propaga de forma nativa como al TenantId).
  • CompositeTenantContext prueba un contexto primario (HTTP) y, si tira InvalidOperationException, cae al de message context.
  • La extension method AgregarTenantContextHibrido() registra todo lo necesario para apps que combinan ambos modos.

Instalacion

dotnet add package Cosmos.MultiTenancy.CritterStack

Uso

Apps hibridas (HTTP + daemon Wolverine)

var builder = WebApplication.CreateBuilder(args);

builder.Services.AgregarTenantContextHibrido();

Los headers HTTP usados son X-Tenant-Id, X-User-Id y X-Organization-Membership-Id (decision de diseño del equipo, no son configurables).

Comportamiento del composite

CompositeTenantContext itera factories en orden:

  1. Primer factory: TrustedHeadersTenantContext (HTTP). Si el scope tiene HttpContext con el header configurado, retorna el valor.
  2. Si el primer factory tira InvalidOperationException, prueba el segundo: WolverineMessageTenantContext. Si el scope es un handler de Wolverine con TenantId en el envelope, retorna el valor.
  3. Si ninguno resuelve, lanza InvalidOperationException con un AggregateException que detalla las fallas.

Solo InvalidOperationException triggerea el fallback. Cualquier otra excepcion se propaga, evitando enmascarar bugs reales (NRE, errores de config, etc.).

Dependencias

  • Cosmos.MultiTenancy.AspNetCore — provee TrustedHeadersTenantContext.
  • WolverineFx — provee IMessageContext y la propagacion automatica del TenantId via envelope.

Paquetes relacionados

Requisitos

  • .NET 10.0 o superior
  • App ASP.NET Core (requiere Microsoft.AspNetCore.App via dependencia transitiva)

Licencia

Copyright © Cosmos. Todos los derechos reservados.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 94 8/13/2026
2.3.1 260 7/22/2026
2.3.0 173 7/21/2026
2.2.0 144 7/21/2026
2.1.0 204 7/17/2026
2.0.0 161 7/15/2026
1.3.0 423 7/9/2026
1.2.6 218 7/3/2026
1.2.5 308 7/1/2026
1.2.4 373 7/1/2026
1.2.3 360 6/18/2026
1.2.2 485 6/12/2026
1.2.1 150 6/12/2026
1.2.0 143 6/11/2026
1.1.0 297 6/3/2026
1.0.0 223 6/2/2026
0.5.1 131 6/2/2026
0.5.0 291 5/28/2026
0.4.2 153 5/28/2026
0.4.1 134 5/28/2026
Loading failed