23.30. Class BaseTable<TData, TModelMapping>
Namespace: ArmoniK.Core.Adapters.MongoDB.Common
Assembly: ArmoniK.Core.Adapters.MongoDB.dll
Base class for tables
public abstract class BaseTable<TData, TModelMapping> : IInitializable, IHealthCheckProvider where TModelMapping : IMongoDataModelMapping<TData>, new()
23.30.1. Type Parameters
TData
Model stored in the table
TModelMapping
Mapping between the model and the document
23.30.2. Inheritance
23.30.3. Implements
IInitializable, IHealthCheckProvider
23.30.4. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
23.30.5. Constructors
23.30.5.1. BaseTable(SessionProvider, MongoCollectionProvider<TData, TModelMapping>, ActivitySource, ILogger)
Construct a new table
protected BaseTable(SessionProvider sessionProvider, MongoCollectionProvider<TData, TModelMapping> collectionProvider, ActivitySource activitySource, ILogger logger)
23.30.5.1.1. Parameters
sessionProvider SessionProvider
Provider for
collectionProvider MongoCollectionProvider<TData, TModelMapping>
Provider for
activitySource ActivitySource
Source for the activities when querying the table
logger ILogger
Logger used to produce logs when querying the table
23.30.5.2. BaseTable(BaseTable<TData, TModelMapping>, bool)
Construct a copy of the table adjusting the read preference
protected BaseTable(BaseTable<TData, TModelMapping> baseTable, bool readOnly)
23.30.5.2.1. Parameters
baseTable BaseTable<TData, TModelMapping>
Source table
readOnly bool
Whether the new table is read only
23.30.6. Properties
23.30.6.1. Logger
Logger used to produce logs when querying the table
protected ILogger Logger { get; }
23.30.6.1.1. Property Value
23.30.7. Methods
23.30.7.1. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
23.30.7.1.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
23.30.7.1.2. Returns
The result of the check containing the status of the class for the health check type.
23.30.7.2. GetCollection()
Get a Read/Write
protected IMongoCollection<TData> GetCollection()
23.30.7.2.1. Returns
IMongoCollection<TData>
Collection
23.30.7.2.2. Exceptions
Table is read-only
23.30.7.3. GetReadCollection()
Get a Read-only
protected IMongoCollection<TData> GetReadCollection()
23.30.7.3.1. Returns
IMongoCollection<TData>
Collection
23.30.7.3.2. Remarks
If table is marked read-only, read preference is set to secondary-preferred
23.30.7.4. GetSession()
Get a
protected IClientSessionHandle GetSession()
23.30.7.4.1. Returns
IClientSessionHandle
session handle
23.30.7.5. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
23.30.7.5.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
23.30.7.5.2. Returns
Task representing the asynchronous execution of the method
23.30.7.6. StartActivity(string)
Creates and starts a new activity if there are active listeners for it, using the specified name and activity kind.
protected Activity? StartActivity(string name = "")
23.30.7.6.1. Parameters
name string
The operation name of the activity.
23.30.7.6.2. Returns
The created activity object, if it had active listeners, or null if it has no event listeners.