Profiles
Run explicitly selected work after versioned migrations without recording a version.
Examples use Classic and Fluent tabs. Your choice follows you through the manual.
Define a named profile
A profile is useful for optional seed data or environment setup. It runs every time its name is selected. Make repeated execution deliberate: use an identifying predicate or other idempotent operation where appropriate.
Classic
using System;
using System.Data;
using DotNetProjects.Migrator;
using DotNetProjects.Migrator.Framework;
[Profile("demo", Order = 10)]
public class DemoData : Migration
{
public override void Up() => Database.InsertIfNotExists("Users",
new[] { "Id", "Name" }, new object[] { 1, "Ada" },
new[] { "Id" }, new object[] { 1 });
public override void Down() { }
}Fluent
using System;
using System.Data;
using DotNetProjects.Migrator;
using DotNetProjects.Migrator.Framework;
using DotNetProjects.Migrator.Framework.Fluent;
[Profile("demo", Order = 10)]
public class DemoData : FluentMigration
{
public override void BuildUp(MigrationBuilder migration)
=> migration.Insert.IntoTable("Users")
.Row(new[] { "Id", "Name" }, new object[] { 1, "Ada" })
.IfNotExists(new[] { "Id" }, new object[] { 1 });
public override void BuildDown(MigrationBuilder migration) { }
}Choose one authoring style
Select a profile
Classic
runner.Options.Profiles.Add("demo");
runner.MigrateToLastVersion();Fluent
runner.Options.Profiles.Add("demo");
runner.MigrateToLastVersion();Shared host · both styles
Profiles accept Order and Scope. Execution orders by Order and then ordinal full type name. Profile execution uses Up and does not create a migration-version entry or use Down as an undo history. An auxiliary-only run preserves existing version history.
Execution versus repeatables
A selected profile runs because it was selected, not because its source checksum changed. Treat this separately from versioned migrations and checksum-based repeatable SQL. Offline CLI SQL generation rejects profiles because it cannot represent the complete lifecycle.