EFMigrationResource Properties
Class Properties 13 members
Represents an EF Core migration resource associated with a project.
Gets or sets the base container image for the migration bundle container.
public string? BundleBaseImage { get; set; }Remarks
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". Gets or sets whether the migration bundle should be self-contained.
public bool BundleSelfContained { get; set; } Gets or sets the target runtime identifier for the migration bundle (e.g., "linux-x64", "win-x64").
public string? BundleTargetRuntime { get; set; } Gets the fully qualified name of the DbContext type to use for migrations, or null to auto-detect.
public string? DbContextTypeName { get; }Remarks
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.
Gets or sets the namespace for new migrations. Used by the Add Migration command.
public string? MigrationNamespace { get; set; }Remarks
If not specified, the namespace will be derived from the project's default namespace.
Gets or sets the output directory for new migrations. Used by the Add Migration command.
public string? MigrationOutputDirectory { get; set; }Remarks
If not specified, migrations will be placed in the default 'Migrations' directory.
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; }Remarks
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.
Gets the parent project resource that contains the DbContext.
public ProjectResource ProjectResource { get; } Gets or sets whether a migration bundle should be generated during publishing.
public bool PublishAsMigrationBundle { get; set; } Gets or sets whether a migration script should be generated during publishing.
public bool PublishAsMigrationScript { get; set; } 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; }Remarks
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. Gets or sets whether the migration script should be idempotent (include IF NOT EXISTS checks).
public bool ScriptIdempotent { get; set; } Gets or sets whether to omit transaction statements from the migration script.
public bool ScriptNoTransactions { get; set; }