MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An implementation of IDatabaseInitializer<TContext> that will use Code First Migrations to update the database to the latest version.
public class MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration> : System.Data.Entity.IDatabaseInitializer<TContext> where TContext : DbContext where TMigrationsConfiguration : DbMigrationsConfiguration<TContext>new()
type MigrateDatabaseToLatestVersion<'Context, 'MigrationsConfiguration (requires 'Context :> DbContext and 'MigrationsConfiguration :> DbMigrationsConfiguration<'Context> and 'MigrationsConfiguration : (new : unit -> 'MigrationsConfiguration))> = class
interface IDatabaseInitializer<'Context (requires 'Context :> DbContext)>
Public Class MigrateDatabaseToLatestVersion(Of TContext, TMigrationsConfiguration)
Implements IDatabaseInitializer(Of TContext)
Type Parameters
- TContext
The type of the context.
- TMigrationsConfiguration
The type of the migrations configuration to use during initialization.
- Inheritance
-
MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>
- Implements
Constructors
MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>() |
Initializes a new instance of the MigrateDatabaseToLatestVersion class that will use the connection information from a context constructed using the default constructor or registered factory if applicable |
MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>(Boolean, TMigrationsConfiguration) |
Initializes a new instance of the MigrateDatabaseToLatestVersion class specifying whether to use the connection information from the context that triggered initialization to perform the migration. Also allows specifying migrations configuration to use during initialization. |
MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>(Boolean) |
Initializes a new instance of the MigrateDatabaseToLatestVersion class specifying whether to use the connection information from the context that triggered initialization to perform the migration. |
MigrateDatabaseToLatestVersion<TContext,TMigrationsConfiguration>(String) |
Initializes a new instance of the MigrateDatabaseToLatestVersion class that will use a specific connection string from the configuration file to connect to the database to perform the migration. |
Methods
InitializeDatabase(TContext) |
Executes the strategy to initialize the database for the given context. |
Applies to
Entity Framework