Table of Contents

Class MigrationResult

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

Represents the result of a migration or rollback operation.

public sealed record MigrationResult : IEquatable<MigrationResult>
Inheritance
MigrationResult
Implements
Inherited Members

Remarks

This record captures the outcome of migration operations including:

  • Whether the operation succeeded
  • Which migrations were applied or removed
  • Any error that occurred during the operation

Properties

AppliedMigrations

Gets the migrations that were applied or removed during this operation.

public IReadOnlyList<AppliedMigration> AppliedMigrations { get; init; }

Property Value

IReadOnlyList<AppliedMigration>

A list of migrations in the order they were processed. Empty if no migrations were processed.

ErrorMessage

Gets the error message if the operation failed.

public string? ErrorMessage { get; init; }

Property Value

string

The error message, or null if the operation succeeded.

Exception

Gets the exception that caused the failure, if any.

public Exception? Exception { get; init; }

Property Value

Exception

The exception, or null if the operation succeeded or no exception was thrown.

Success

Gets a value indicating whether the migration operation succeeded.

public required bool Success { get; init; }

Property Value

bool

true if the operation completed successfully; otherwise, false.

Methods

Failed(string, Exception?)

Creates a failed migration result.

public static MigrationResult Failed(string errorMessage, Exception? exception = null)

Parameters

errorMessage string

The error message.

exception Exception

The exception that caused the failure, if any.

Returns

MigrationResult

A failed migration result.

NoMigrationsPending()

Creates a successful migration result with no migrations applied.

public static MigrationResult NoMigrationsPending()

Returns

MigrationResult

A successful migration result indicating no migrations were needed.

Succeeded(IReadOnlyList<AppliedMigration>)

Creates a successful migration result.

public static MigrationResult Succeeded(IReadOnlyList<AppliedMigration> appliedMigrations)

Parameters

appliedMigrations IReadOnlyList<AppliedMigration>

The migrations that were applied.

Returns

MigrationResult

A successful migration result.