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) { // ... }}Parameters
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.Returns
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.Exceptions
InvalidOperationExceptionThrown if migrations for this context type have already been added.Remarks
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) { // ... }}Parameters
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.Returns
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.Exceptions
InvalidOperationExceptionThrown if migrations for this context type have already been added.Remarks
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) { // ... }}Parameters
builderIResourceBuilder<ProjectResource>The resource builder for the project.namestringThe name of the migration resource.Returns
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.Exceptions
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) { // ... }}Parameters
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.Returns
IResourceBuilder<EFMigrationResource>An EF migration resource builder for chaining additional configuration.Exceptions
InvalidOperationExceptionThrown if migrations have already been added for any DbContext type on this project.