Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DropCreateDatabaseAlways<TContext> Class

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

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

System.Object
  System.Data.Entity.DropCreateDatabaseAlways<TContext>

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

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

Type Parameters

TContext

The type of the context.

The DropCreateDatabaseAlways<TContext> type exposes the following members.

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

  NameDescription
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 methodSeedA method that should be overridden to actually add data to the context for seeding. The default implementation does nothing.
Public methodToString (Inherited from Object.)
Top

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft