22.37. 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
22.37.1. Inheritance
22.37.2. Implements
IInitializable, IHealthCheckProvider
22.37.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
22.37.4. Constructors
22.37.4.1. SessionProvider(IMongoClient)
Initializes a new instance of the
[UsedImplicitly]
public SessionProvider(IMongoClient client)
22.37.4.1.1. Parameters
client IMongoClient
The MongoDB client used to create sessions.
22.37.5. Methods
22.37.5.1. Check(HealthCheckTag)
Checks the health of the MongoDB session provider.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
22.37.5.1.1. Parameters
tag HealthCheckTag
The health check tag indicating the type of health check.
22.37.5.1.2. Returns
A task that represents the asynchronous health check operation, containing the result of the health check.
22.37.5.1.3. Exceptions
Thrown when the provided health check tag is not recognized.
22.37.5.2. Get()
Retrieves the current MongoDB session handle.
public IClientSessionHandle Get()
22.37.5.2.1. Returns
IClientSessionHandle
The current
22.37.5.2.2. Exceptions
Thrown when the session handle has not been initialized.
Ensure that the
22.37.5.3. Init(CancellationToken)
Initializes the MongoDB session handle.
public Task Init(CancellationToken cancellationToken)
22.37.5.3.1. Parameters
cancellationToken CancellationToken
A cancellation token to observe while waiting for the initialization to complete.
22.37.5.3.2. Returns
A task that represents the asynchronous initialization operation.