.NET API
IMigrationApplier
Tracon.Abstractions.dllApplies the pending migrations of the active SQL persistence provider.
public interface IMigrationApplierRemarks
Section titled “Remarks”Each Use* extension (UsePostgreSql, UseSqlServer, and
UseSqlite) registers this interface with Replace, resolving to
the same instance as MigrationRunner.
This exists as its own interface, separate from
ISqlPersistenceDiagnostics, because MigrationRunner is
compiled from source SHARED across the three SQL provider packages
(Tracon.Sql.Shared): a consumer that references more than one
provider - the tracon global tool does, for its migrate
command - sees three DIFFERENT MigrationRunner types with the same
name, and an unqualified reference to it does not compile (CS0433).
This interface lives in Tracon.Abstractions, referenced
identically by all three, so IServiceProvider.GetRequiredService<IMigrationApplier>
resolves without needing to know which provider is active.
DI lifetime — singleton. Registered as a singleton with
Replace by whichever SQL provider is active.
Methods
Section titled “Methods”ApplyAsync(CancellationToken)
Section titled “ ApplyAsync(CancellationToken)”Applies every pending migration, in order.
ValueTask<int> ApplyAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The number of migrations applied.