21.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
21.37.1. Inheritance
21.37.2. Implements
IInitializable, IHealthCheckProvider
21.37.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.37.4. Constructors
21.37.4.1. SessionProvider(IMongoClient)
Initializes a new instance of the
[UsedImplicitly]
public SessionProvider(IMongoClient client)
21.37.4.1.1. Parameters
client IMongoClient
The MongoDB client used to create sessions.
21.37.5. Methods
21.37.5.1. Check(HealthCheckTag)
Checks the health of the MongoDB session provider.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
21.37.5.1.1. Parameters
tag HealthCheckTag
The health check tag indicating the type of health check.
21.37.5.1.2. Returns
A task that represents the asynchronous health check operation, containing the result of the health check.
21.37.5.1.3. Exceptions
Thrown when the provided health check tag is not recognized.
21.37.5.2. Get()
Retrieves the current MongoDB session handle.
public IClientSessionHandle Get()
21.37.5.2.1. Returns
IClientSessionHandle
The current
21.37.5.2.2. Exceptions
Thrown when the session handle has not been initialized.
Ensure that the
21.37.5.3. Init(CancellationToken)
Initializes the MongoDB session handle.
public Task Init(CancellationToken cancellationToken)
21.37.5.3.1. Parameters
cancellationToken CancellationToken
A cancellation token to observe while waiting for the initialization to complete.
21.37.5.3.2. Returns
A task that represents the asynchronous initialization operation.