Skip to main content
Table of Contents

Class StrataraIdentityStore

Namespace
Stratara.EventSourcing.EntityFrameworkCore.IdentityStore
Assembly
Stratara.EventSourcing.EntityFrameworkCore.dll

The identity store several hosts can share on PostgreSQL: ASP.NET Identity's tables, passkeys included, and the tenant directory — memberships, tenant selections, settings and API keys — with the migrations that create and evolve them shipped in this package.

public sealed class StrataraIdentityStore : IdentityStore<StrataraIdentityStore, IdentityUser>, IInfrastructure<IServiceProvider>, IDbContextDependencies, IDbSetCache, IDbContextPoolable, IResettableService, IDisposable, IAsyncDisposable, IIdentityDbContext, IDbContext
Inheritance
StrataraIdentityStore
Implements
Inherited Members
Extension Methods

Remarks

The tables and the migration history live in the schema Schema, whose name is fixed for every host and every release; the history table is MigrationsHistoryTable. Register the store with AddStrataraIdentityStore(), apply its migrations with MigrateStrataraIdentityStoreAsync(), and generate no migrations of your own for these tables.

The account type is IdentityUser and cannot be extended: every host sharing the store sees the same columns. Keep what you know about a person beyond the account outside the identity store. A host that does not share its store can still derive its own context from IdentityStore<TContext, TUser> with a user type of its own.

Within a major version the schema changes only additively — new tables, new indexes, new columns that are nullable or have a database default — so a host on an earlier release of the same major version keeps working on a store a later release migrated.

Constructors

StrataraIdentityStore(DbContextOptions<StrataraIdentityStore>)

The identity store several hosts can share on PostgreSQL: ASP.NET Identity's tables, passkeys included, and the tenant directory — memberships, tenant selections, settings and API keys — with the migrations that create and evolve them shipped in this package.

public StrataraIdentityStore(DbContextOptions<StrataraIdentityStore> options)

Parameters

options DbContextOptions<StrataraIdentityStore>

Options bound by AddStrataraIdentityStore().

Remarks

The tables and the migration history live in the schema Schema, whose name is fixed for every host and every release; the history table is MigrationsHistoryTable. Register the store with AddStrataraIdentityStore(), apply its migrations with MigrateStrataraIdentityStoreAsync(), and generate no migrations of your own for these tables.

The account type is IdentityUser and cannot be extended: every host sharing the store sees the same columns. Keep what you know about a person beyond the account outside the identity store. A host that does not share its store can still derive its own context from IdentityStore<TContext, TUser> with a user type of its own.

Within a major version the schema changes only additively — new tables, new indexes, new columns that are nullable or have a database default — so a host on an earlier release of the same major version keeps working on a store a later release migrated.

Fields

ConnectionStringName

The connection string the store reads from configuration; where it is absent, the host's default connection is used.

public const string ConnectionStringName = "identitydb"

Field Value

string

MigrationsHistoryTable

The table, inside Schema, that records the store's applied migrations.

public const string MigrationsHistoryTable = "__stratara_identity_migrations"

Field Value

string

Schema

The schema the store's tables and its migration history live in.

public const string Schema = "stratara_identity"

Field Value

string

Properties

SchemaVersion

The ASP.NET Identity schema version the store is built at — the one the framework's identity registration configures — whatever SchemaVersion the host sets, so every host's model matches the shipped migrations. The key and phone-number lengths that ASP.NET Identity otherwise takes from the host's StoreOptions are fixed for the same reason.

protected override Version SchemaVersion { get; }

Property Value

Version

Methods

OnModelCreating(ModelBuilder)

Configures the schema needed for the identity framework.

protected override void OnModelCreating(ModelBuilder builder)

Parameters

builder ModelBuilder

The builder being used to construct the model for this context.