26.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()

26.30.1. Type Parameters

TData

Model stored in the table

TModelMapping

Mapping between the model and the document

26.30.2. Inheritance

objectBaseTable<TData, TModelMapping>

26.30.3. Implements

IInitializable, IHealthCheckProvider

26.30.4. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

26.30.5. Constructors

26.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)

26.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

26.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)

26.30.5.2.1. Parameters

baseTable BaseTable<TData, TModelMapping>

Source table

readOnly bool

Whether the new table is read only

26.30.6. Properties

26.30.6.1. Logger

Logger used to produce logs when querying the table

protected ILogger Logger { get; }

26.30.6.1.1. Property Value

ILogger

26.30.7. Methods

26.30.7.1. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

26.30.7.1.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

26.30.7.1.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

26.30.7.2. GetCollection()

Get a Read/Write from the collection provider

protected IMongoCollection<TData> GetCollection()

26.30.7.2.1. Returns

IMongoCollection<TData>

Collection

26.30.7.2.2. Exceptions

ConstraintException

Table is read-only

26.30.7.3. GetReadCollection()

Get a Read-only from the collection provider

protected IMongoCollection<TData> GetReadCollection()

26.30.7.3.1. Returns

IMongoCollection<TData>

Collection

26.30.7.3.2. Remarks

If table is marked read-only, read preference is set to secondary-preferred

26.30.7.4. GetSession()

Get a

protected IClientSessionHandle GetSession()

26.30.7.4.1. Returns

IClientSessionHandle

session handle

26.30.7.5. Init(CancellationToken)

Executes an initialization process for the class

public Task Init(CancellationToken cancellationToken)

26.30.7.5.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

26.30.7.5.2. Returns

Task

Task representing the asynchronous execution of the method

26.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 = "")

26.30.7.6.1. Parameters

name string

The operation name of the activity.

26.30.7.6.2. Returns

Activity?

The created activity object, if it had active listeners, or null if it has no event listeners.