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
Exception
Gets the exception that caused the failure, if any.
public Exception? Exception { get; init; }
Property Value
Success
Gets a value indicating whether the migration operation succeeded.
public required bool Success { get; init; }
Property Value
Methods
Failed(string, Exception?)
Creates a failed migration result.
public static MigrationResult Failed(string errorMessage, Exception? exception = null)
Parameters
errorMessagestringThe error message.
exceptionExceptionThe 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
appliedMigrationsIReadOnlyList<AppliedMigration>The migrations that were applied.
Returns
- MigrationResult
A successful migration result.