DropCreateDatabaseAlways<TContext> DropCreateDatabaseAlways<TContext> DropCreateDatabaseAlways<TContext> Class

Definition

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.

public class DropCreateDatabaseAlways<TContext> : System.Data.Entity.IDatabaseInitializer<TContext> where TContext : DbContext
type DropCreateDatabaseAlways<'Context (requires 'Context :> DbContext)> = class
    interface IDatabaseInitializer<'Context (requires 'Context :> DbContext)>
Public Class DropCreateDatabaseAlways(Of TContext)
Implements IDatabaseInitializer(Of TContext)

Type Parameters

TContext

The type of the context.

Inheritance
DropCreateDatabaseAlways<TContext>DropCreateDatabaseAlways<TContext>DropCreateDatabaseAlways<TContext>
Implements

Constructors

DropCreateDatabaseAlways<TContext>() DropCreateDatabaseAlways<TContext>() DropCreateDatabaseAlways<TContext>()

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

Methods

InitializeDatabase(TContext) InitializeDatabase(TContext) InitializeDatabase(TContext)

Executes the strategy to initialize the database for the given context.

Seed(TContext) Seed(TContext) Seed(TContext)

A method that should be overridden to actually add data to the context for seeding. The default implementation does nothing.

Applies to