Table of Contents

Interface IProjectionGenerationReader<TProjection>

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

A read-only handle pinned to one exact projection destination for one operation.

public interface IProjectionGenerationReader<TProjection> : IAsyncDisposable where TProjection : class

Type Parameters

TProjection

The explicitly supported read schema.

Inherited Members

Remarks

Disposal releases this handle, never a client borrowed from the host. No method provisions storage.

Properties

DestinationScope

Gets the storage scope this handle last resolved.

string? DestinationScope { get; }

Property Value

string

A credential-free storage scope, or null when no resolve has run yet.

Remarks

Null means "not resolved yet", and nothing else. It does NOT mean the scope cannot be established — that case is an exception from GetDestinationScopeAsync(CancellationToken), because a handle that cannot name the storage it addresses cannot certify a generation, and a caller comparing a recorded scope against null cannot tell an unresolvable client from an unverified one. Providers that derive the scope from configuration may answer immediately; providers that resolve it from storage metadata answer null until the resolve has run, and MUST answer the resolved value afterwards. Answering null once the scope IS established states the opposite of the truth and is a conformance failure.

Methods

CountAsync(IDictionary<string, object>?, CancellationToken)

Counts matching projections in the ambient tenant.

Task<long> CountAsync(IDictionary<string, object>? filters, CancellationToken cancellationToken)

Parameters

filters IDictionary<string, object>

Provider-supported filters.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<long>

The matching count.

GetByIdAsync(string, CancellationToken)

Reads a projection in the ambient tenant.

Task<TProjection?> GetByIdAsync(string id, CancellationToken cancellationToken)

Parameters

id string

Projection identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TProjection>

The projection, or null when absent.

GetDestinationScopeAsync(CancellationToken)

Resolves the actual client scope before reading; does not provision storage.

ValueTask<string> GetDestinationScopeAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancels metadata resolution.

Returns

ValueTask<string>

The verified scope. Never null and never blank.

Exceptions

InvalidOperationException

The storage scope cannot be established, so this handle cannot verify which storage it addresses.

QueryAsync(IDictionary<string, object>?, QueryOptions?, CancellationToken)

Queries the selected generation using its supported field names.

Task<IReadOnlyList<TProjection>> QueryAsync(IDictionary<string, object>? filters, QueryOptions? options, CancellationToken cancellationToken)

Parameters

filters IDictionary<string, object>

Provider-supported filters.

options QueryOptions

Sorting and pagination.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<TProjection>>

Matching projections in the ambient tenant.