# EFMigrationResource

- Kind: `class`
- Package: [Aspire.Hosting.EntityFrameworkCore](/reference/api/csharp/aspire.hosting.entityframeworkcore.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Aspire.Hosting.EntityFrameworkCore`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs)
- Inherits: `ContainerResource`

Represents an EF Core migration resource associated with a project.

## Definition

```csharp
namespace Aspire.Hosting.EntityFrameworkCore;

public class EFMigrationResource
    : Aspire.Hosting.ApplicationModel.ContainerResource
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.EntityFrameworkCore/EFMigrationResource`

## Remarks

The resource inherits from `ApplicationModel.ContainerResource` so it can be published as a container image that runs the migration bundle at deploy time when [EFMigrationResourceBuilderExtensions.PublishAsMigrationBundle(IResourceBuilder<EFMigrationResource>, string?, bool, bool, string?)](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresourcebuilderextensions/methods.md#publishasmigrationbundle-iresourcebuilder-efmigrationresource-string-bool-bool-string) is called with `publishContainer: true`.

## Constructors

- [EFMigrationResource(string, ProjectResource, string?)](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/constructors.md#constructor-string-projectresource-string) -- Represents an EF Core migration resource associated with a project.

## Properties

- [BundleBaseImage](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#bundlebaseimage) : `string?` `get; set` -- Gets or sets the base container image for the migration bundle container.
- [BundleSelfContained](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#bundleselfcontained) : `bool` `get; set` -- Gets or sets whether the migration bundle should be self-contained.
- [BundleTargetRuntime](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#bundletargetruntime) : `string?` `get; set` -- Gets or sets the target runtime identifier for the migration bundle (e.g., "linux-x64", "win-x64").
- [DbContextTypeName](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#dbcontexttypename) : `string?` `get` -- Gets the fully qualified name of the DbContext type to use for migrations, or null to auto-detect.
- [MigrationNamespace](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#migrationnamespace) : `string?` `get; set` -- Gets or sets the namespace for new migrations. Used by the Add Migration command.
- [MigrationOutputDirectory](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#migrationoutputdirectory) : `string?` `get; set` -- Gets or sets the output directory for new migrations. Used by the Add Migration command.
- [MigrationsProjectPath](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#migrationsprojectpath) : `string?` `get; set` -- Gets or sets the path to the project containing the migrations, when it's not the same as the startup project.
- [ProjectResource](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#projectresource) : `ProjectResource` `get` -- Gets the parent project resource that contains the DbContext.
- [PublishAsMigrationBundle](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#publishasmigrationbundle) : `bool` `get; set` -- Gets or sets whether a migration bundle should be generated during publishing.
- [PublishAsMigrationScript](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#publishasmigrationscript) : `bool` `get; set` -- Gets or sets whether a migration script should be generated during publishing.
- [PublishBundleContainer](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#publishbundlecontainer) : `bool` `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.
- [ScriptIdempotent](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#scriptidempotent) : `bool` `get; set` -- Gets or sets whether the migration script should be idempotent (include IF NOT EXISTS checks).
- [ScriptNoTransactions](/reference/api/csharp/aspire.hosting.entityframeworkcore/efmigrationresource/properties.md#scriptnotransactions) : `bool` `get; set` -- Gets or sets whether to omit transaction statements from the migration script.
