Database.SetInitializer<TContext> Method (IDatabaseInitializer<TContext>)
Sets the database initializer to use for the given context type. The database initializer is called when a the given DbContext type is used to access a database for the first time. The default strategy for Code First contexts is an instance of CreateDatabaseIfNotExists<TContext>.
Assembly: EntityFramework (in EntityFramework.dll)
public static void SetInitializer<TContext>( IDatabaseInitializer<TContext> strategy ) where TContext : DbContext
Parameters
- strategy
-
Type:
System.Data.Entity.IDatabaseInitializer<TContext>
The initializer to use, or null to disable initialization for the given context type.
Type Parameters
- TContext
The type of the context.