Docs
Tenantry CoreAPI reference

TenantryHttpTenantBuilderExtensions class

Namespace: Microsoft.Extensions.DependencyInjection · Package: Tenantry.Http · API reference

Sends the current tenant to the services an application calls over HTTP or gRPC.

public static class TenantryHttpTenantBuilderExtensions

Methods

AddHttpPropagation<TKey>(ITenantBuilder<TKey>)

Lets the HTTP and gRPC clients marked with TenantryHttpClientBuilderExtensions.UseTenantry send the current tenant's id to the services they call, in the TenantPropagation.HeaderName header. The receiving service reads it with Tenantry.AspNetCore's ResolveFromPropagationHeader(...).

public static ITenantBuilder<TKey> AddHttpPropagation<TKey>(this ITenantBuilder<TKey> builder) where TKey : IEquatable<TKey>, IParsable<TKey>

Type parameters:

  • TKey: The tenant identifier type.

Parameters:

Returns: ITenantBuilder<TKey>: The same builder for chaining.

builder.Services.AddTenantry<Guid>(tenant => tenant
    .UseStore<AppTenantStore>()
    .AddHttpPropagation());

builder.Services.AddHttpClient<BillingClient>(c => c.BaseAddress = new Uri("https://billing.internal"))     .UseTenantry(); ```

On this page