RelationalDatabaseCreator Class
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 abstract class RelationalDatabaseCreator : Microsoft.EntityFrameworkCore.Storage.IDatabaseCreator, Microsoft.EntityFrameworkCore.Storage.IRelationalDatabaseCreator
public abstract class RelationalDatabaseCreator : Microsoft.EntityFrameworkCore.Internal.IServiceInjectionSite, Microsoft.EntityFrameworkCore.Storage.IDatabaseCreator, Microsoft.EntityFrameworkCore.Storage.IRelationalDatabaseCreator
public abstract class RelationalDatabaseCreator : Microsoft.EntityFrameworkCore.Storage.IDatabaseCreatorWithCanConnect, Microsoft.EntityFrameworkCore.Storage.IRelationalDatabaseCreator
type RelationalDatabaseCreator = class
interface IRelationalDatabaseCreator
interface IDatabaseCreator
type RelationalDatabaseCreator = class
interface IRelationalDatabaseCreator
interface IDatabaseCreator
interface IServiceInjectionSite
type RelationalDatabaseCreator = class
interface IRelationalDatabaseCreator
interface IDatabaseCreator
interface IDatabaseCreatorWithCanConnect
Public MustInherit Class RelationalDatabaseCreator
Implements IDatabaseCreator, IRelationalDatabaseCreator
Public MustInherit Class RelationalDatabaseCreator
Implements IDatabaseCreator, IRelationalDatabaseCreator, IServiceInjectionSite
Public MustInherit Class RelationalDatabaseCreator
Implements IDatabaseCreatorWithCanConnect, IRelationalDatabaseCreator
- Inheritance
-
RelationalDatabaseCreator
- Implements
-
IDatabaseCreator IRelationalDatabaseCreator Microsoft.EntityFrameworkCore.Internal.IServiceInjectionSite IDatabaseCreatorWithCanConnect
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.
Constructors
RelationalDatabaseCreator(IModel, IRelationalConnection, IMigrationsModelDiffer, IMigrationsSqlGenerator, IMigrationCommandExecutor, IExecutionStrategyFactory) |
Initializes a new instance of the RelationalDatabaseCreator class. |
RelationalDatabaseCreator(IModel, IRelationalConnection, IMigrationsModelDiffer, IMigrationsSqlGenerator, IMigrationCommandExecutor) |
Obsolete.
Initializes a new instance of the RelationalDatabaseCreator class. |
RelationalDatabaseCreator(RelationalDatabaseCreatorDependencies) |
Initializes a new instance of the RelationalDatabaseCreator class. |
Properties
Connection |
Gets the connection for the database. |
Dependencies |
Relational provider-specific dependencies for this service. |
ExecutionStrategyFactory |
Gets the IExecutionStrategyFactory to be used. |
MigrationCommandExecutor |
Gets the IMigrationCommandExecutor to be used. |
Model |
Gets the model for the context this creator is being used with. |
Methods
CanConnect() |
Determines whether or not the database is available and can be connected to. |
CanConnectAsync(CancellationToken) |
Determines whether or not the database is available and can be connected to. |
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. |
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. |
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 and no effort is made to remove just the database objects that are used by the model for this context. |
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 and no effort is made to remove just the database objects that are used by the model for this context. |
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. |
GetCreateTablesCommands() |
Gets the commands that will create all tables from the model. |
GetCreateTablesCommands(MigrationsSqlGenerationOptions) |
Gets the commands that will create all tables from the 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. |
Explicit Interface Implementations
IServiceInjectionSite.InjectServices(IServiceProvider) |
This API supports the Entity Framework Core infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases. |
Applies to
Entity Framework