21.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()
21.34.1. Type Parameters
TData
Model stored in the table
TModelMapping
Mapping between the model and the document
21.34.2. Inheritance
21.34.3. Implements
IInitializable, IHealthCheckProvider
21.34.4. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.34.5. Constructors
21.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)
21.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
21.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)
21.34.5.2.1. Parameters
baseTable BaseTable<TData, TModelMapping>
Source table
readOnly bool
Whether the new table is read only
21.34.6. Properties
21.34.6.1. Logger
Logger used to produce logs when querying the table
protected ILogger Logger { get; }
21.34.6.1.1. Property Value
21.34.7. Methods
21.34.7.1. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
21.34.7.1.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
21.34.7.1.2. Returns
The result of the check containing the status of the class for the health check type.
21.34.7.2. GetCollection()
Get a Read/Write
protected IMongoCollection<TData> GetCollection()
21.34.7.2.1. Returns
IMongoCollection<TData>
Collection
21.34.7.2.2. Exceptions
Table is read-only
21.34.7.3. GetReadCollection()
Get a Read-only
protected IMongoCollection<TData> GetReadCollection()
21.34.7.3.1. Returns
IMongoCollection<TData>
Collection
21.34.7.3.2. Remarks
If table is marked read-only, read preference is set to secondary-preferred
21.34.7.4. GetSession()
Get a
protected IClientSessionHandle GetSession()
21.34.7.4.1. Returns
IClientSessionHandle
session handle
21.34.7.5. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
21.34.7.5.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
21.34.7.5.2. Returns
Task representing the asynchronous execution of the method
21.34.7.6. StartActivity(string)
Creates a new activity if there are active listeners for it, using the specified name and activity kind.
protected Activity? StartActivity(string name = "")
21.34.7.6.1. Parameters
name string
The operation name of the activity.
21.34.7.6.2. Returns
The created activity object, if it had active listeners, or null if it has no event listeners.