IDatabaseInitializer<TContext> Interface

Definition

An implementation of this interface is used to initialize the underlying database when an instance of a DbContext derived class is used for the first time. This initialization can conditionally create the database and/or seed it with data. The strategy used is set using the static InitializationStrategy property of the Database class. The following implementations are provided: DropCreateDatabaseIfModelChanges<TContext>, DropCreateDatabaseAlways<TContext>, CreateDatabaseIfNotExists<TContext>.

public interface IDatabaseInitializer<in TContext> where TContext : DbContext
type IDatabaseInitializer<'Context (requires 'Context :> DbContext)> = interface
Public Interface IDatabaseInitializer(Of In TContext)

Type Parameters

TContext

The type of the context.

This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
Derived

Methods

InitializeDatabase(TContext)

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

Applies to