.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 provider’s migration runner - the same instance
ISqlPersistenceDiagnostics resolves to.
This is the public way to apply migrations from your own code, for example
from a deployment step when AutoApplyMigrations is off. The runner
itself is not public: each SQL provider package compiles its own copy, and
this interface, which lives in Tracon.Abstractions, is the one type
all three share. IServiceProvider.GetRequiredService<IMigrationApplier>
therefore resolves without knowing which provider is active, even in an
application that references more than one of them.
DI lifetime — singleton. Registered as a singleton with
Replace by whichever SQL provider is active.
Call this interface; the SQL provider package supplies the implementation, so do not implement or replace it.
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.