Table of Contents

Class MongoMigrationExecutor

Namespace
eQuantic.Core.Data.MongoDb.Migration
Assembly
eQuantic.Core.Data.MongoDb.dll

Applies provider-agnostic MigrationOperations to MongoDB through the driver: it creates collections and indexes, converts and renames fields across existing documents, runs data updates and hands the raw database to escape-hatch steps. Typed member selectors are resolved to their stored BSON element names (honouring [BsonElement] / class maps), so a migration never spells a field as a string.

public sealed class MongoMigrationExecutor : IMigrationExecutor
Inheritance
MongoMigrationExecutor
Implements
Inherited Members

Constructors

MongoMigrationExecutor(IMongoDatabase, Func<Type, string>?)

Initializes the executor for a database.

public MongoMigrationExecutor(IMongoDatabase database, Func<Type, string>? collectionName = null)

Parameters

database IMongoDatabase

The target database.

collectionName Func<Type, string>

Resolves an entity type to its collection name; defaults to the type name, matching the repository's default (MongoUnitOfWork.CollectionName).

Methods

ApplyAsync(IReadOnlyList<MigrationOperation>, CancellationToken)

Applies the operations, in order.

public Task ApplyAsync(IReadOnlyList<MigrationOperation> operations, CancellationToken cancellationToken = default)

Parameters

operations IReadOnlyList<MigrationOperation>

The declared operations.

cancellationToken CancellationToken

The cancellation token.

Returns

Task