IRelationalDatabaseCreator Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Performs database/schema creation, and other related operations.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public interface IRelationalDatabaseCreator : Microsoft.EntityFrameworkCore.Storage.IDatabaseCreator
type IRelationalDatabaseCreator = interface
interface IDatabaseCreator
Public Interface IRelationalDatabaseCreator
Implements IDatabaseCreator
- Derived
- Implements
Remarks
The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.
See Implementation of database providers and extensions for more information and examples.
Methods
CanConnect() |
Determines whether or not the database is available and can be connected to. (Inherited from IDatabaseCreator) |
CanConnectAsync(CancellationToken) |
Determines whether or not the database is available and can be connected to. (Inherited from IDatabaseCreator) |
Create() |
Creates the physical database. Does not attempt to populate it with any schema. |
CreateAsync(CancellationToken) |
Asynchronously creates the physical database. Does not attempt to populate it with any schema. |
CreateTables() |
Creates all tables for the current model in the database. No attempt is made to incrementally update the schema. It is assumed that none of the tables exist in the database. |
CreateTablesAsync(CancellationToken) |
Asynchronously creates all tables for the current model in the database. No attempt is made to incrementally update the schema. It is assumed that none of the tables exist in the database. |
Delete() |
Deletes the physical database. |
DeleteAsync(CancellationToken) |
Asynchronously deletes the physical database. |
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. (Inherited from IDatabaseCreator) |
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. (Inherited from IDatabaseCreator) |
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. (Inherited from IDatabaseCreator) |
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. (Inherited from IDatabaseCreator) |
Exists() |
Determines whether the physical database exists. No attempt is made to determine if the database contains the schema for the current model. |
ExistsAsync(CancellationToken) |
Asynchronously determines whether the physical database exists. No attempt is made to determine if the database contains the schema for the current model. |
GenerateCreateScript() |
Generates a script to create all tables for the current model. |
HasTables() |
Determines whether the database contains any tables. No attempt is made to determine if tables belong to the current model or not. |
HasTablesAsync(CancellationToken) |
Asynchronously determines whether the database contains any tables. No attempt is made to determine if tables belong to the current model or not. |
Applies to
Entity Framework