22.34. 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()
22.34.1. Type Parameters
TData
Model stored in the table
TModelMapping
Mapping between the model and the document
22.34.2. Inheritance
22.34.3. Implements
IInitializable, IHealthCheckProvider
22.34.4. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
22.34.5. Constructors
22.34.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)
22.34.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
22.34.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)
22.34.5.2.1. Parameters
baseTable BaseTable<TData, TModelMapping>
Source table
readOnly bool
Whether the new table is read only
22.34.6. Properties
22.34.6.1. Logger
Logger used to produce logs when querying the table
protected ILogger Logger { get; }
22.34.6.1.1. Property Value
22.34.7. Methods
22.34.7.1. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
22.34.7.1.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
22.34.7.1.2. Returns
The result of the check containing the status of the class for the health check type.
22.34.7.2. GetCollection()
Get a Read/Write
protected IMongoCollection<TData> GetCollection()
22.34.7.2.1. Returns
IMongoCollection<TData>
Collection
22.34.7.2.2. Exceptions
Table is read-only
22.34.7.3. GetReadCollection()
Get a Read-only
protected IMongoCollection<TData> GetReadCollection()
22.34.7.3.1. Returns
IMongoCollection<TData>
Collection
22.34.7.3.2. Remarks
If table is marked read-only, read preference is set to secondary-preferred
22.34.7.4. GetSession()
Get a
protected IClientSessionHandle GetSession()
22.34.7.4.1. Returns
IClientSessionHandle
session handle
22.34.7.5. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
22.34.7.5.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.34.7.5.2. Returns
Task representing the asynchronous execution of the method
22.34.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 = "")
22.34.7.6.1. Parameters
name string
The operation name of the activity.
22.34.7.6.2. Returns
The created activity object, if it had active listeners, or null if it has no event listeners.