Interface IExistsProjectionStore<TProjection>
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
ISP sub-interface for projection stores that support optimized existence checks.
public interface IExistsProjectionStore<TProjection> : IProjectionStore<TProjection>, IServiceProvider where TProjection : class
Type Parameters
TProjectionThe projection type. Must be a reference type.
- Inherited Members
- Extension Methods
Remarks
Providers implement this interface to offer a faster existence check than the
default GetByIdAsync(string, CancellationToken) fallback.
For example, SQL Server providers can use SELECT TOP 1 1 WHERE Id = @id
without deserializing the full projection state.
Consumers use the extension method ExistsAsync<TProjection>(IProjectionStore<TProjection>, string, CancellationToken) which automatically detects and uses this interface when available:
bool exists = await store.ExistsAsync("order-123", ct);
Methods
ExistsAsync(string, CancellationToken)
Checks whether a projection with the specified identifier exists using a provider-optimized query that avoids full deserialization.
[RequiresUnreferencedCode("Implementations serialize the projection type reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
[RequiresDynamicCode("Implementations serialize the projection type reflectively; supply JsonSerializerOptions with a source-generated resolver for trimming and AOT.")]
Task<bool> ExistsAsync(string id, CancellationToken cancellationToken)
Parameters
idstringThe projection identifier to check.
cancellationTokenCancellationTokenCancellation token.