Database.SetInitializer<TContext> Method
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.
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>.
public static void SetInitializer<TContext> (System.Data.Entity.IDatabaseInitializer<TContext> strategy) where TContext : System.Data.Entity.DbContext;
static member SetInitializer : System.Data.Entity.IDatabaseInitializer<'Context (requires 'Context :> System.Data.Entity.DbContext)> -> unit (requires 'Context :> System.Data.Entity.DbContext)
Public Shared Sub SetInitializer(Of TContext As DbContext) (strategy As IDatabaseInitializer(Of TContext))
Type Parameters
- TContext
The type of the context.
Parameters
- strategy
- IDatabaseInitializer<TContext>
The initializer to use, or null to disable initialization for the given context type.
Applies to
Entity Framework