Table of Contents

Interface ILockingStrategy

Namespace
Compendium.Core.Domain.Primitives
Assembly
Compendium.Core.dll

Defines a strategy for locking operations in aggregate roots. Enables different locking approaches based on performance requirements.

public interface ILockingStrategy : IDisposable
Inherited Members

Methods

ExecuteReadAsync<T>(Func<Task<T>>, CancellationToken)

Executes an async read operation with appropriate locking.

Task<T> ExecuteReadAsync<T>(Func<Task<T>> operation, CancellationToken cancellationToken = default)

Parameters

operation Func<Task<T>>

The operation to execute.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<T>

The result of the operation.

Type Parameters

T

The return type of the operation.

ExecuteRead<T>(Func<T>)

Executes a read operation with appropriate locking.

T ExecuteRead<T>(Func<T> operation)

Parameters

operation Func<T>

The operation to execute.

Returns

T

The result of the operation.

Type Parameters

T

The return type of the operation.

ExecuteWrite(Action)

Executes a write operation with appropriate locking.

void ExecuteWrite(Action operation)

Parameters

operation Action

The operation to execute.

ExecuteWriteAsync(Func<Task>, CancellationToken)

Executes an async write operation with appropriate locking.

Task ExecuteWriteAsync(Func<Task> operation, CancellationToken cancellationToken = default)

Parameters

operation Func<Task>

The operation to execute.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

A task representing the async operation.