DropCreateDatabaseAlways<TContext> Class

An implementation of IDatabaseInitializer<TContext> that will always recreate and optionally re-seed the database with data the first time that a context is used in the application domain. To seed the database, create a derived class and override the Seed method.


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

public class DropCreateDatabaseAlways<TContext> : IDatabaseInitializer<TContext>
where TContext : DbContext

Type Parameters


The type of the context.

The DropCreateDatabaseAlways<TContext> type exposes the following members.

Public methodDropCreateDatabaseAlways<TContext>Initializes a new instance of the DropCreateDatabaseAlways<TContext> class.

Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodInitializeDatabaseExecutes the strategy to initialize the database for the given context.
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodSeedWhen overridden will add data to the context for seeding. The default implementation does nothing.
Public methodToString (Inherited from Object.)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.