Table of Contents

Interface IDocumentPersistenceProvider

Namespace
Excalibur.Data.Persistence
Assembly
Excalibur.Data.Abstractions.dll

Specialized persistence provider for document stores that handles DocumentDataRequest execution with document-specific capabilities. Implementation-specific services are available via GetService(Type).

public interface IDocumentPersistenceProvider : IPersistenceProvider, IAsyncDisposable, IDisposable
Inherited Members

Properties

DocumentStoreType

Gets the document store type (e.g., "MongoDB", "ElasticSearch", "CosmosDB").

string DocumentStoreType { get; }

Property Value

string

The document store type (e.g., "MongoDB", "ElasticSearch", "CosmosDB").

Methods

ExecuteDocumentAsync<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult>, CancellationToken)

Executes a DocumentDataRequest with document store-specific optimizations.

Task<TResult> ExecuteDocumentAsync<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult> documentRequest, CancellationToken cancellationToken)

Parameters

documentRequest IDocumentDataRequest<TConnection, TResult>

The document data request to execute.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

The result of the document request execution.

Type Parameters

TConnection

The type of the document database connection.

TResult

The type of the result.

ExecuteDocumentBatchAsync<TConnection>(IEnumerable<IDocumentDataRequest<TConnection, object>>, CancellationToken)

Executes a batch of DocumentDataRequests as a single unit for improved performance.

Task<IEnumerable<object>> ExecuteDocumentBatchAsync<TConnection>(IEnumerable<IDocumentDataRequest<TConnection, object>> documentRequests, CancellationToken cancellationToken)

Parameters

documentRequests IEnumerable<IDocumentDataRequest<TConnection, object>>

The collection of DocumentDataRequests to execute as a batch.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<IEnumerable<object>>

A collection of results corresponding to each request in the batch.

Type Parameters

TConnection

The type of the document database connection.

ExecuteDocumentInTransactionAsync<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult>, ITransactionScope, CancellationToken)

Executes a DocumentDataRequest within a transaction scope (if supported by the document store).

Task<TResult> ExecuteDocumentInTransactionAsync<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult> documentRequest, ITransactionScope transactionScope, CancellationToken cancellationToken)

Parameters

documentRequest IDocumentDataRequest<TConnection, TResult>

The document data request to execute.

transactionScope ITransactionScope

The transaction scope to use.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<TResult>

The result of the document request execution.

Type Parameters

TConnection

The type of the document database connection.

TResult

The type of the result.

ValidateDocumentRequest<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult>)

Validates that a DocumentDataRequest is compatible with this document store provider.

bool ValidateDocumentRequest<TConnection, TResult>(IDocumentDataRequest<TConnection, TResult> documentRequest)

Parameters

documentRequest IDocumentDataRequest<TConnection, TResult>

The DocumentDataRequest to validate.

Returns

bool

True if the request is valid for this provider; otherwise, false.

Type Parameters

TConnection

The type of the document database connection.

TResult

The type of the result.