Export (0) Print
Expand All

Database.Initialize Method

Entity Framework 5.0

Runs the registered IDatabaseInitializer(TContext) on this context. If the parameter force is set to true, then the initializer is run regardless of whether or not it has been run before. This can be useful if a database is deleted while an app is running and needs to be reinitialized.

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

member Initialize : 
        force:bool -> unit


Type: System.Boolean

If set to true the initializer is run even if it has already been run.

If force is set to false, then the initializer is only run if it has not already been run for this context, model, and connection in this application domain. This method is typically used when it is necessary to ensure that the database has been created and seeded before starting some operation, such as when the operation is part of a transaction.

© 2014 Microsoft