Class MigrationSource
Migrations registered explicitly, instead of discovered by scanning an assembly. Assembly
scanning is reflection: it finds nothing under NativeAOT, because a type reachable only through
reflection has its constructor trimmed. Naming the migration at the call site
(source.Add<WidgetsSetup>()) constructs it with a plain new, which the AOT compiler
roots — so the explicit form is both the AOT-safe registration and a faster startup (no scan).
public sealed class MigrationSource
- Inheritance
-
MigrationSource
- Inherited Members
Properties
Migrations
The registered migrations, in registration order (the runner orders them by timestamp).
public IReadOnlyList<Migration> Migrations { get; }
Property Value
Methods
Add(Migration)
Registers a migration instance (for migrations that take constructor arguments).
public MigrationSource Add(Migration migration)
Parameters
migrationMigrationThe migration.
Returns
- MigrationSource
The same source for chaining.
Add<TMigration>()
Registers a migration by type — constructed with new, so nothing is reflected.
public MigrationSource Add<TMigration>() where TMigration : Migration, new()
Returns
- MigrationSource
The same source for chaining.
Type Parameters
TMigrationThe migration type.