# EFMigrationResource

- Module: [Aspire.Hosting.EntityFrameworkCore](/reference/api/go/aspire.hosting.entityframeworkcore.md)
- Version: `17.0.0-preview.1.26565.2`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Represents an EF Core migration resource associated with a project.

## Definition

```go
type EFMigrationResource interface {
    IComputeResource
    Resource
    ResourceWithArgs
    ResourceWithEndpoints
    ResourceWithEnvironment
    ResourceWithWaitSupport
}
```

## Embeds

- `IComputeResource`
- `Resource`
- `ResourceWithArgs`
- `ResourceWithEndpoints`
- `ResourceWithEnvironment`
- `ResourceWithWaitSupport`

## Properties

- `BundleBaseImage`: `*string` `get/set` -- Gets or sets the base container image for the migration bundle container.
- `BundleSelfContained`: `bool` `get/set` -- Gets or sets whether the migration bundle should be self-contained.
- `BundleTargetRuntime`: `*string` `get/set` -- Gets or sets the target runtime identifier for the migration bundle (e.g., "linux-x64", "win-x64").
- `DbContextTypeName`: `*string` `get` -- Gets the fully qualified name of the DbContext type to use for migrations, or null to auto-detect.
- `MigrationNamespace`: `*string` `get/set` -- Gets or sets the namespace for new migrations. Used by the Add Migration command.
- `MigrationOutputDirectory`: `*string` `get/set` -- Gets or sets the output directory for new migrations. Used by the Add Migration command.
- `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`: `ProjectResource` `get` -- Gets the parent project resource that contains the DbContext.
- `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.
- `ResourceTypeDisplayName`: `string` `get` -- Gets the ResourceTypeDisplayName property
- `ScriptIdempotent`: `bool` `get/set` -- Gets or sets whether the migration script should be idempotent (include IF NOT EXISTS checks).
- `ScriptNoTransactions`: `bool` `get/set` -- Gets or sets whether to omit transaction statements from the migration script.
- `StartupProjectResource`: `DotnetProgramResource` `get` -- Gets the startup .NET program resource that contains the DbContext configuration.

## Methods

- [PublishAsMigrationBundle](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/publishasmigrationbundle.md) -- `method` -- Configures the EF migration resource to generate a migration bundle during publishing.
  ```go
  PublishAsMigrationBundle(options ...*PublishAsMigrationBundleOptions) EFMigrationResource
  ```
- [PublishAsMigrationScript](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/publishasmigrationscript.md) -- `method` -- Configures the EF migration resource to generate a migration script during publishing.
  ```go
  PublishAsMigrationScript(options ...*PublishAsMigrationScriptOptions) EFMigrationResource
  ```
- [RunDatabaseUpdateOnStart](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/rundatabaseupdateonstart.md) -- `method` -- Configures the EF migration resource to run database update when the AppHost starts.
  ```go
  RunDatabaseUpdateOnStart() EFMigrationResource
  ```
- [WithMigrationNamespace](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/withmigrationnamespace.md) -- `method` -- Configures the namespace for new migrations created with the Add Migration command.
  ```go
  WithMigrationNamespace(namespace string) EFMigrationResource
  ```
- [WithMigrationOutputDirectory](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/withmigrationoutputdirectory.md) -- `method` -- Configures the output directory for new migrations created with the Add Migration command.
  ```go
  WithMigrationOutputDirectory(outputDirectory string) EFMigrationResource
  ```
- [WithMigrationsProject](/reference/api/go/aspire.hosting.entityframeworkcore/efmigrationresource/withmigrationsproject.md) -- `method` -- Configures a separate project containing migrations for polyglot AppHosts.
  ```go
  WithMigrationsProject(options ...*WithMigrationsProjectOptions) EFMigrationResource
  ```
