26.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
26.33.1. Inheritance
26.33.2. Implements
IInitializable, IHealthCheckProvider
26.33.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
26.33.4. Constructors
26.33.4.1. SessionProvider(IMongoClient, MongoDB)
Initializes a new instance of the
[UsedImplicitly]
public SessionProvider(IMongoClient client, MongoDB options)
26.33.4.1.1. Parameters
client IMongoClient
The MongoDB client used to create sessions.
options MongoDB
Options for MongoDB
26.33.5. Methods
26.33.5.1. Check(HealthCheckTag)
Checks the health of the MongoDB session provider.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
26.33.5.1.1. Parameters
tag HealthCheckTag
The health check tag indicating the type of health check.
26.33.5.1.2. Returns
A task that represents the asynchronous health check operation, containing the result of the health check.
26.33.5.1.3. Exceptions
Thrown when the provided health check tag is not recognized.
26.33.5.2. Get()
Retrieves the current MongoDB session handle.
public IClientSessionHandle Get()
26.33.5.2.1. Returns
IClientSessionHandle
The current
26.33.5.2.2. Exceptions
Thrown when the session handle has not been initialized.
Ensure that the
26.33.5.3. Init(CancellationToken)
Initializes the MongoDB session handle.
public Task Init(CancellationToken cancellationToken)
26.33.5.3.1. Parameters
cancellationToken CancellationToken
A cancellation token to observe while waiting for the initialization to complete.
26.33.5.3.2. Returns
A task that represents the asynchronous initialization operation.