# EFMigrationResource Properties

- Package: [Aspire.Hosting.EntityFrameworkCore](/reference/api/csharp/aspire.hosting.entityframeworkcore.md)
- Type: [EFMigrationResource](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource.md)
- Kind: `Properties`
- Members: `13`

Represents an EF Core migration resource associated with a project.

## BundleBaseImage

- Name: `BundleBaseImage`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets the base container image for the migration bundle container.

```csharp
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"`.

## BundleSelfContained

- Name: `BundleSelfContained`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether the migration bundle should be self-contained.

```csharp
public bool BundleSelfContained { get; set; }
```

## BundleTargetRuntime

- Name: `BundleTargetRuntime`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets the target runtime identifier for the migration bundle (e.g., "linux-x64", "win-x64").

```csharp
public string? BundleTargetRuntime { get; set; }
```

## DbContextTypeName

- Name: `DbContextTypeName`
- Modifiers: `nullable` `get`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs#L38)

Gets the fully qualified name of the DbContext type to use for migrations, or null to auto-detect.

```csharp
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.

## MigrationNamespace

- Name: `MigrationNamespace`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets the namespace for new migrations. Used by the Add Migration command.

```csharp
public string? MigrationNamespace { get; set; }
```

## Remarks

If not specified, the namespace will be derived from the project's default namespace.

## MigrationOutputDirectory

- Name: `MigrationOutputDirectory`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets the output directory for new migrations. Used by the Add Migration command.

```csharp
public string? MigrationOutputDirectory { get; set; }
```

## Remarks

If not specified, migrations will be placed in the default 'Migrations' directory.

## MigrationsProjectPath

- Name: `MigrationsProjectPath`
- Modifiers: `nullable` `get; set`
- Returns: `string?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets the path to the project containing the migrations, when it's not the same as the startup project.

```csharp
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.

## ProjectResource

- Name: `ProjectResource`
- Modifiers: `get`
- Returns: `ProjectResource`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs#L29)

Gets the parent project resource that contains the DbContext.

```csharp
public ProjectResource ProjectResource { get; }
```

## PublishAsMigrationBundle

- Name: `PublishAsMigrationBundle`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether a migration bundle should be generated during publishing.

```csharp
public bool PublishAsMigrationBundle { get; set; }
```

## PublishAsMigrationScript

- Name: `PublishAsMigrationScript`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether a migration script should be generated during publishing.

```csharp
public bool PublishAsMigrationScript { get; set; }
```

## PublishBundleContainer

- Name: `PublishBundleContainer`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether the migration bundle should be published as a container image that applies the migrations to the database at deploy time.

```csharp
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`.

## ScriptIdempotent

- Name: `ScriptIdempotent`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether the migration script should be idempotent (include IF NOT EXISTS checks).

```csharp
public bool ScriptIdempotent { get; set; }
```

## ScriptNoTransactions

- Name: `ScriptNoTransactions`
- Modifiers: `get; set`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)

Gets or sets whether to omit transaction statements from the migration script.

```csharp
public bool ScriptNoTransactions { get; set; }
```
