Table of Contents

Class MongoDbTrackingExtensions

Namespace
Tharga.MongoDB
Assembly
Tharga.MongoDB.dll

Extension methods for tracking external collections in the database monitor. Use this when a package registers its own collection types via DI but needs them to appear in the monitor as "in code" rather than "NotInCode".

public static class MongoDbTrackingExtensions
Inheritance
MongoDbTrackingExtensions
Inherited Members

Methods

TrackMongoCollection(IServiceCollection, Type, Type)

Tracks a collection type so the database monitor recognises it as registered in code. This does NOT register the type in DI — only tells the monitor about it. Can be called before or after AddMongoDB; the actual merge happens in UseMongoDB.

public static IServiceCollection TrackMongoCollection(this IServiceCollection services, Type serviceType, Type implementationType)

Parameters

services IServiceCollection

The service collection.

serviceType Type

The collection interface type.

implementationType Type

The collection implementation type.

Returns

IServiceCollection

TrackMongoCollection<TService, TImplementation>(IServiceCollection)

Tracks a collection type so the database monitor recognises it as registered in code. Generic convenience overload.

public static IServiceCollection TrackMongoCollection<TService, TImplementation>(this IServiceCollection services)

Parameters

services IServiceCollection

Returns

IServiceCollection

Type Parameters

TService

The collection interface type.

TImplementation

The collection implementation type.