Skip to content
Docs Try Aspire
Docs Try

EFMigrationResource Properties

Class Properties 13 members
Represents an EF Core migration resource associated with a project.
BundleBaseImage Section titled BundleBaseImage nullable string?
Gets or sets the base container image for the migration bundle container.
public string? BundleBaseImage { get; set; }
When set, this overrides the default base image selection entirely. Use this when the default image (derived from the project's target framework) isn't suitable — for example when targeting a preview SDK or a custom base image with extra dependencies. Example: "mcr.microsoft.com/dotnet/runtime:11.0-preview".
BundleSelfContained Section titled BundleSelfContained bool
Gets or sets whether the migration bundle should be self-contained.
public bool BundleSelfContained { get; set; }
BundleTargetRuntime Section titled BundleTargetRuntime nullable string?
Gets or sets the target runtime identifier for the migration bundle (e.g., "linux-x64", "win-x64").
public string? BundleTargetRuntime { get; set; }
DbContextTypeName Section titled DbContextTypeName nullable string?
Gets the fully qualified name of the DbContext type to use for migrations, or null to auto-detect.
public string? DbContextTypeName { get; }
This property is used to specify which DbContext to use when the project contains multiple DbContext types. When null, the EF Core tools will auto-detect the DbContext to use.
MigrationNamespace Section titled MigrationNamespace nullable string?
Gets or sets the namespace for new migrations. Used by the Add Migration command.
public string? MigrationNamespace { get; set; }
If not specified, the namespace will be derived from the project's default namespace.
MigrationOutputDirectory Section titled MigrationOutputDirectory nullable string?
Gets or sets the output directory for new migrations. Used by the Add Migration command.
public string? MigrationOutputDirectory { get; set; }
If not specified, migrations will be placed in the default 'Migrations' directory.
MigrationsProjectPath Section titled MigrationsProjectPath nullable string?
Gets or sets the path to the project containing the migrations, when it's not the same as the startup project.
public string? MigrationsProjectPath { get; set; }
If not specified, migrations are assumed to be in the startup project. When specified, this project's path will be used as the target for migration operations.
ProjectResource Section titled ProjectResource ProjectResource
Gets the parent project resource that contains the DbContext.
public ProjectResource ProjectResource { get; }
PublishAsMigrationBundle Section titled PublishAsMigrationBundle bool
Gets or sets whether a migration bundle should be generated during publishing.
public bool PublishAsMigrationBundle { get; set; }
PublishAsMigrationScript Section titled PublishAsMigrationScript bool
Gets or sets whether a migration script should be generated during publishing.
public bool PublishAsMigrationScript { get; set; }
PublishBundleContainer Section titled PublishBundleContainer bool
Gets or sets whether the migration bundle should be published as a container image that applies the migrations to the database at deploy time.
public bool PublishBundleContainer { get; set; }
When true, the resource is materialized as a ApplicationModel.ContainerResource carrying a generated Dockerfile that wraps the migration bundle. The compute environment (Docker Compose, Azure Container Apps, Kubernetes, Azure App Service, Azure Functions, etc.) deploys it alongside the other compute resources and supplies the connection string from any ApplicationModel.IResourceWithConnectionString dependency declared via WithReference or WaitFor.
ScriptIdempotent Section titled ScriptIdempotent bool
Gets or sets whether the migration script should be idempotent (include IF NOT EXISTS checks).
public bool ScriptIdempotent { get; set; }
ScriptNoTransactions Section titled ScriptNoTransactions bool
Gets or sets whether to omit transaction statements from the migration script.
public bool ScriptNoTransactions { get; set; }