DbMigrationsConfiguration<TContext> DbMigrationsConfiguration<TContext> DbMigrationsConfiguration<TContext> Class


Configuration relating to the use of migrations for a given model.

public class DbMigrationsConfiguration<TContext> : System.Data.Entity.Migrations.DbMigrationsConfiguration where TContext : DbContext
type DbMigrationsConfiguration<'Context (requires 'Context :> DbContext)> = class
    inherit DbMigrationsConfiguration
Public Class DbMigrationsConfiguration(Of TContext)
Inherits DbMigrationsConfiguration

Type Parameters


The context representing the model that this configuration applies to.



DbMigrationsConfiguration<TContext>() DbMigrationsConfiguration<TContext>() DbMigrationsConfiguration<TContext>()

Initializes a new instance of the DbMigrationsConfiguration class.


Equals(Object) Equals(Object) Equals(Object)
GetHashCode() GetHashCode() GetHashCode()
GetHistoryContextFactory(String) GetHistoryContextFactory(String) GetHistoryContextFactory(String)

Gets the history context factory that is set to be used with a given database provider.

(Inherited from DbMigrationsConfiguration)
GetSqlGenerator(String) GetSqlGenerator(String) GetSqlGenerator(String)

Gets the SQL generator that is set to be used with a given database provider.

(Inherited from DbMigrationsConfiguration)
GetType() GetType() GetType()
MemberwiseClone() MemberwiseClone() MemberwiseClone()
Seed(TContext) Seed(TContext) Seed(TContext)

Runs after upgrading to the latest migration to allow seed data to be updated.

SetHistoryContextFactory(String, Func<DbConnection,String,HistoryContext>) SetHistoryContextFactory(String, Func<DbConnection,String,HistoryContext>) SetHistoryContextFactory(String, Func<DbConnection,String,HistoryContext>)

Adds a new factory for creating HistoryContext instances to be used for a given database provider.

(Inherited from DbMigrationsConfiguration)
SetSqlGenerator(String, MigrationSqlGenerator) SetSqlGenerator(String, MigrationSqlGenerator) SetSqlGenerator(String, MigrationSqlGenerator)

Adds a new SQL generator to be used for a given database provider.

(Inherited from DbMigrationsConfiguration)
ToString() ToString() ToString()


AutomaticMigrationDataLossAllowed AutomaticMigrationDataLossAllowed AutomaticMigrationDataLossAllowed

Gets or sets a value indicating if data loss is acceptable during automatic migration. If set to false an exception will be thrown if data loss may occur as part of an automatic migration.

(Inherited from DbMigrationsConfiguration)
AutomaticMigrationsEnabled AutomaticMigrationsEnabled AutomaticMigrationsEnabled

Gets or sets a value indicating if automatic migrations can be used when migrating the database.

(Inherited from DbMigrationsConfiguration)
CodeGenerator CodeGenerator CodeGenerator

Gets or sets the code generator to be used when scaffolding migrations.

(Inherited from DbMigrationsConfiguration)
CommandTimeout CommandTimeout CommandTimeout

Gets or sets the timeout value used for the individual commands within a migration. A null value indicates that the default value of the underlying provider will be used.

(Inherited from DbMigrationsConfiguration)
ContextKey ContextKey ContextKey

Gets or sets the string used to distinguish migrations belonging to this configuration from migrations belonging to other configurations using the same database. This property enables migrations from multiple different models to be applied to a single database.

(Inherited from DbMigrationsConfiguration)
ContextType ContextType ContextType

Gets or sets the derived DbContext representing the model to be migrated.

(Inherited from DbMigrationsConfiguration)
MigrationsAssembly MigrationsAssembly MigrationsAssembly

Gets or sets the assembly containing code-based migrations.

(Inherited from DbMigrationsConfiguration)
MigrationsDirectory MigrationsDirectory MigrationsDirectory

Gets or sets the sub-directory that code-based migrations are stored in. Note that this property must be set to a relative path for a sub-directory under the Visual Studio project root; it cannot be set to an absolute path.

(Inherited from DbMigrationsConfiguration)
MigrationsNamespace MigrationsNamespace MigrationsNamespace

Gets or sets the namespace used for code-based migrations.

(Inherited from DbMigrationsConfiguration)
TargetDatabase TargetDatabase TargetDatabase

Gets or sets a value to override the connection of the database to be migrated.

(Inherited from DbMigrationsConfiguration)


DefaultMigrationsDirectory DefaultMigrationsDirectory DefaultMigrationsDirectory

The default directory that migrations are stored in.

(Inherited from DbMigrationsConfiguration)

Applies to