Export (0) Print
Expand All

Database.SetInitializer<TContext> Method

Entity Framework 5.0

Gets or sets the database initialization strategy. The database initialization strategy is called when DbContext instance is initialized from a DbCompiledModel.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

public static void SetInitializer<TContext>(
	IDatabaseInitializer<TContext> strategy
where TContext : DbContext

Type Parameters


The type of the context.


Type: System.Data.Entity.IDatabaseInitializer<TContext>

The strategy.

The initialization strategy can optionally check for database existence, create a new database, and seed the database with data. The default strategy is an instance of CreateDatabaseIfNotExists<TContext>.

© 2015 Microsoft