Table of Contents

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

TProjection

The 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

id string

The projection identifier to check.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

true if a projection with the specified id exists; otherwise, false.