1 out of 4 rated this helpful - Rate this topic

DropCreateDatabaseAlways<TContext> Class

Entity Framework

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.

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.

  Name Description
Public method DropCreateDatabaseAlways<TContext> Initializes a new instance of the DropCreateDatabaseAlways<TContext> class.
Top
  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Public method InitializeDatabase Executes the strategy to initialize the database for the given context.
Protected method MemberwiseClone (Inherited from Object.)
Protected method Seed When overridden will add data to the context for seeding. The default implementation does nothing.
Public method ToString (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.
Did you find this helpful?
(1500 characters remaining)