Skip to content
DocsTry Aspire
DocsTry

EFResourceBuilderExtensions Methods

ClassMethods4 members
Provides extension methods for adding EF Core migration management to projects.
AddEFMigrations(IResourceBuilder<ProjectResource>, string, string)Section titled AddEFMigrations(IResourceBuilder<ProjectResource>, string, string)extensionIResourceBuilder<EFMigrationResource>
Adds EF Core migration management for a specific DbContext type.
public static class EFResourceBuilderExtensions
{
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
string name,
string dbContextTypeName)
{
// ...
}
}
builderIResourceBuilder<ProjectResource>The resource builder for the project.
namestringThe name of the migration resource.
dbContextTypeNamestringThe fully qualified name of the DbContext type to manage migrations for.
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.
InvalidOperationExceptionThrown if migrations for this context type have already been added.
Multiple calls to this method with different context types are supported, allowing you to manage migrations for multiple DbContexts in the same project.
AddEFMigrations(IResourceBuilder<ProjectResource>, string, string, Action<IResourceBuilder<DotnetToolResource>>)Section titled AddEFMigrations(IResourceBuilder<ProjectResource>, string, string, Action<IResourceBuilder<DotnetToolResource>>)extensionIResourceBuilder<EFMigrationResource>
Adds EF Core migration management for a specific DbContext type.
public static class EFResourceBuilderExtensions
{
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
string name,
string dbContextTypeName,
Action<IResourceBuilder<DotnetToolResource>>? configureToolResource)
{
// ...
}
}
builderIResourceBuilder<ProjectResource>The resource builder for the project.
namestringThe name of the migration resource.
dbContextTypeNamestringThe fully qualified name of the DbContext type to manage migrations for.
configureToolResourceAction<IResourceBuilder<DotnetToolResource>>Optional callback to configure the dotnet-ef tool resource used for migrations.
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.
InvalidOperationExceptionThrown if migrations for this context type have already been added.
Multiple calls to this method with different context types are supported, allowing you to manage migrations for multiple DbContexts in the same project.
AddEFMigrations(IResourceBuilder<ProjectResource>, string)Section titled AddEFMigrations(IResourceBuilder<ProjectResource>, string)extensionIResourceBuilder<EFMigrationResource>
Adds EF Core migration management for the only DbContext type in the target project.
public static class EFResourceBuilderExtensions
{
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
string name)
{
// ...
}
}
builderIResourceBuilder<ProjectResource>The resource builder for the project.
namestringThe name of the migration resource.
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.
InvalidOperationExceptionThrown if migrations have already been added for any DbContext type on this project.
AddEFMigrations(IResourceBuilder<ProjectResource>, string, Action<IResourceBuilder<DotnetToolResource>>)Section titled AddEFMigrations(IResourceBuilder<ProjectResource>, string, Action<IResourceBuilder<DotnetToolResource>>)extensionIResourceBuilder<EFMigrationResource>
Adds EF Core migration management for the only DbContext type in the target project.
public static class EFResourceBuilderExtensions
{
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
string name,
Action<IResourceBuilder<DotnetToolResource>>? configureToolResource)
{
// ...
}
}
builderIResourceBuilder<ProjectResource>The resource builder for the project.
namestringThe name of the migration resource.
configureToolResourceAction<IResourceBuilder<DotnetToolResource>>Optional callback to configure the dotnet-ef tool resource used for migrations.
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.
InvalidOperationExceptionThrown if migrations have already been added for any DbContext type on this project.