23.33. Class SessionProvider
Namespace: ArmoniK.Core.Adapters.MongoDB.Common
Assembly: ArmoniK.Core.Adapters.MongoDB.dll
Provides a MongoDB session handle for database operations, implementing initialization and health checks.
public class SessionProvider : IInitializable, IHealthCheckProvider
23.33.1. Inheritance
23.33.2. Implements
IInitializable, IHealthCheckProvider
23.33.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
23.33.4. Constructors
23.33.4.1. SessionProvider(IMongoClient, MongoDB)
Initializes a new instance of the
[UsedImplicitly]
public SessionProvider(IMongoClient client, MongoDB options)
23.33.4.1.1. Parameters
client IMongoClient
The MongoDB client used to create sessions.
options MongoDB
Options for MongoDB
23.33.5. Methods
23.33.5.1. Check(HealthCheckTag)
Checks the health of the MongoDB session provider.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
23.33.5.1.1. Parameters
tag HealthCheckTag
The health check tag indicating the type of health check.
23.33.5.1.2. Returns
A task that represents the asynchronous health check operation, containing the result of the health check.
23.33.5.1.3. Exceptions
Thrown when the provided health check tag is not recognized.
23.33.5.2. Get()
Retrieves the current MongoDB session handle.
public IClientSessionHandle Get()
23.33.5.2.1. Returns
IClientSessionHandle
The current
23.33.5.2.2. Exceptions
Thrown when the session handle has not been initialized.
Ensure that the
23.33.5.3. Init(CancellationToken)
Initializes the MongoDB session handle.
public Task Init(CancellationToken cancellationToken)
23.33.5.3.1. Parameters
cancellationToken CancellationToken
A cancellation token to observe while waiting for the initialization to complete.
23.33.5.3.2. Returns
A task that represents the asynchronous initialization operation.