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
storeIIdentityMapStoreThe identity map store.
externalSystemstringThe external system name.
externalIdstringThe external identifier value.
aggregateTypestringThe aggregate type name.
aggregateIdTKeyThe internal aggregate ID to map to.
cancellationTokenCancellationTokenCancellation token.
Returns
Type Parameters
TKeyThe 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
storeIIdentityMapStoreThe identity map store.
externalSystemstringThe external system name.
externalIdstringThe external identifier value.
aggregateTypestringThe target aggregate type name.
cancellationTokenCancellationTokenCancellation token.
Returns
Type Parameters
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
storeIIdentityMapStoreThe identity map store.
externalSystemstringThe external system name.
externalIdstringThe external identifier value.
aggregateTypestringThe aggregate type name.
aggregateIdTKeyThe aggregate ID to bind if no mapping exists.
cancellationTokenCancellationTokenCancellation token.
Returns
- ValueTask<IdentityBindResult>
A result containing the aggregate ID (either newly bound or existing) and whether the binding was newly created.
Type Parameters
TKeyThe aggregate ID type.