Table of Contents

Class IdentityMapStoreExtensions

Namespace
Excalibur.Data.IdentityMap
Assembly
Excalibur.Data.IdentityMap.dll

Typed extension methods for IIdentityMapStore providing compile-time safety for aggregate ID types.

public static class IdentityMapStoreExtensions
Inheritance
IdentityMapStoreExtensions
Inherited Members

Methods

BindAsync<TKey>(IIdentityMapStore, string, string, string, TKey, CancellationToken)

Creates or updates a mapping between an external identifier and a typed aggregate ID.

public static ValueTask BindAsync<TKey>(this IIdentityMapStore store, string externalSystem, string externalId, string aggregateType, TKey aggregateId, CancellationToken cancellationToken) where TKey : notnull

Parameters

store IIdentityMapStore

The identity map store.

externalSystem string

The external system name.

externalId string

The external identifier value.

aggregateType string

The aggregate type name.

aggregateId TKey

The internal aggregate ID to map to.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask

Type Parameters

TKey

The aggregate ID type.

ResolveAsync<TKey>(IIdentityMapStore, string, string, string, CancellationToken)

Resolves an external identifier to a typed aggregate ID.

public static ValueTask<TKey?> ResolveAsync<TKey>(this IIdentityMapStore store, string externalSystem, string externalId, string aggregateType, CancellationToken cancellationToken) where TKey : struct, IParsable<TKey>

Parameters

store IIdentityMapStore

The identity map store.

externalSystem string

The external system name.

externalId string

The external identifier value.

aggregateType string

The target aggregate type name.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<TKey?>

The typed aggregate ID, or null if no mapping exists.

Type Parameters

TKey

The aggregate ID type (e.g., Guid, int, long).

TryBindAsync<TKey>(IIdentityMapStore, string, string, string, TKey, CancellationToken)

Creates a mapping only if no mapping exists, using a typed aggregate ID.

public static ValueTask<IdentityBindResult> TryBindAsync<TKey>(this IIdentityMapStore store, string externalSystem, string externalId, string aggregateType, TKey aggregateId, CancellationToken cancellationToken) where TKey : notnull

Parameters

store IIdentityMapStore

The identity map store.

externalSystem string

The external system name.

externalId string

The external identifier value.

aggregateType string

The aggregate type name.

aggregateId TKey

The aggregate ID to bind if no mapping exists.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<IdentityBindResult>

A result containing the aggregate ID (either newly bound or existing) and whether the binding was newly created.

Type Parameters

TKey

The aggregate ID type.