Table of Contents

Interface ICloudNativePersistenceProvider

Namespace
Excalibur.Data.CloudNative
Assembly
Excalibur.Data.Abstractions.dll

Defines core persistence operations for cloud-native document databases.

public interface ICloudNativePersistenceProvider : IDocumentPersistenceProvider, IPersistenceProvider, IAsyncDisposable, IDisposable
Inherited Members

Remarks

This interface extends IDocumentPersistenceProvider with cloud-native specific capabilities including partition key management and configurable consistency levels.

Advanced features are available as ISP sub-interfaces via GetService(Type):

Supported Providers:

  • Azure Cosmos DB
  • AWS DynamoDB
  • Google Cloud Firestore

Methods

CreateAsync<TDocument>(TDocument, IPartitionKey, CancellationToken)

Creates a new document with partition key.

Task<CloudOperationResult<TDocument>> CreateAsync<TDocument>(TDocument document, IPartitionKey partitionKey, CancellationToken cancellationToken) where TDocument : class

Parameters

document TDocument

The document to create.

partitionKey IPartitionKey

The partition key for the document.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<CloudOperationResult<TDocument>>

The operation result with cost information.

Type Parameters

TDocument

The document type.

DeleteAsync(string, IPartitionKey, string?, CancellationToken)

Deletes a document with optimistic concurrency using ETag.

Task<CloudOperationResult> DeleteAsync(string id, IPartitionKey partitionKey, string? etag, CancellationToken cancellationToken)

Parameters

id string

The document ID to delete.

partitionKey IPartitionKey

The partition key for the document.

etag string

The ETag for optimistic concurrency (null to skip check).

cancellationToken CancellationToken

Cancellation token.

Returns

Task<CloudOperationResult>

The operation result with cost information.

GetByIdAsync<TDocument>(string, IPartitionKey, IConsistencyOptions?, CancellationToken)

Gets a document by ID with partition key and consistency options.

Task<TDocument?> GetByIdAsync<TDocument>(string id, IPartitionKey partitionKey, IConsistencyOptions? consistencyOptions, CancellationToken cancellationToken) where TDocument : class

Parameters

id string

The document ID.

partitionKey IPartitionKey

The partition key for the document.

consistencyOptions IConsistencyOptions

Consistency options for the read.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TDocument>

The document if found, null otherwise.

Type Parameters

TDocument

The document type.

UpdateAsync<TDocument>(TDocument, IPartitionKey, string?, CancellationToken)

Updates a document with optimistic concurrency using ETag.

Task<CloudOperationResult<TDocument>> UpdateAsync<TDocument>(TDocument document, IPartitionKey partitionKey, string? etag, CancellationToken cancellationToken) where TDocument : class

Parameters

document TDocument

The document to update.

partitionKey IPartitionKey

The partition key for the document.

etag string

The ETag for optimistic concurrency (null to skip check).

cancellationToken CancellationToken

Cancellation token.

Returns

Task<CloudOperationResult<TDocument>>

The operation result with new ETag and cost information.

Type Parameters

TDocument

The document type.