Table of Contents

Class PostgresTenantShardingExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Excalibur.EventSourcing.Postgres.dll

Extension methods for registering Postgres tenant shard providers.

public static class PostgresTenantShardingExtensions
Inheritance
PostgresTenantShardingExtensions
Inherited Members

Methods

UsePostgresTenantEventStore(IEventSourcingBuilder)

Registers the Postgres ITenantStoreResolver<TStore> for IEventStore, enabling tenant-aware event store routing to Postgres databases.

public static IEventSourcingBuilder UsePostgresTenantEventStore(this IEventSourcingBuilder builder)

Parameters

builder IEventSourcingBuilder

The event sourcing builder.

Returns

IEventSourcingBuilder

The builder for fluent chaining.

Examples

services.AddExcalibur(x => x.AddEventSourcing(builder =>
{
    builder.EnableTenantSharding(options =>
    {
        options.DefaultShardId = "shard-default";
    });
    builder.UsePostgresTenantEventStore();
}));

Remarks

Must be called after EnableTenantSharding. Each shard's connection string from ShardInfo is used to create a dedicated PostgresEventStore instance with its own NpgsqlDataSource for connection pooling.

Schema defaults to public unless SchemaName is set for the shard.