IDatabaseCreator IDatabaseCreator Interface

Definition

Creates and deletes databases for a given database provider.

This interface is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IDatabaseCreator
Public Interface IDatabaseCreator

Methods

EnsureCreated() EnsureCreated()

Ensures that the database for the context exists. If it exists, no action is taken. If it does not exist then the database and all its schema are created. If the database exists, then no effort is made to ensure it is compatible with the model for this context.

bool EnsureCreated()
Function EnsureCreated As Boolean
Returns
System.Boolean System.Boolean

True if the database is created, false if it already existed.

EnsureCreatedAsync(CancellationToken) EnsureCreatedAsync(CancellationToken)

Asynchronously ensures that the database for the context exists. If it exists, no action is taken. If it does not exist then the database and all its schema are created. If the database exists, then no effort is made to ensure it is compatible with the model for this context.

Task<bool> EnsureCreatedAsync(CancellationToken cancellationToken = null)
Function EnsureCreatedAsync(cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Parameters
cancellationToken
System.Threading.CancellationToken System.Threading.CancellationToken

A System.Threading.CancellationToken to observe while waiting for the task to complete.

Returns
System.Threading.Tasks.Task<System.Boolean> System.Threading.Tasks.Task(Of System.Boolean)

A task that represents the asynchronous save operation. The task result contains true if the database is created, false if it already existed.

EnsureDeleted() EnsureDeleted()

Ensures that the database for the context does not exist. If it does not exist, no action is taken. If it does exist then the database is deleted.

Warning: The entire database is deleted an no effort is made to remove just the database objects that are used by the model for this context.

bool EnsureDeleted()
Function EnsureDeleted As Boolean
Returns
System.Boolean System.Boolean

True if the database is deleted, false if it did not exist.

EnsureDeletedAsync(CancellationToken) EnsureDeletedAsync(CancellationToken)

Asynchronously ensures that the database for the context does not exist. If it does not exist, no action is taken. If it does exist then the database is deleted.

Warning: The entire database is deleted an no effort is made to remove just the database objects that are used by the model for this context.

Task<bool> EnsureDeletedAsync(CancellationToken cancellationToken = null)
Function EnsureDeletedAsync(cancellationToken As CancellationToken = Nothing) As Task(Of Boolean)
Parameters
cancellationToken
System.Threading.CancellationToken System.Threading.CancellationToken

A System.Threading.CancellationToken to observe while waiting for the task to complete.

Returns
System.Threading.Tasks.Task<System.Boolean> System.Threading.Tasks.Task(Of System.Boolean)

A task that represents the asynchronous save operation. The task result contains true if the database is deleted, false if it did not exist.