Class MongoDatabaseCreator
- Namespace
- MongoDB.EntityFrameworkCore.Storage
- Assembly
- MongoDB.EntityFrameworkCore.dll
Creates and deletes databases on MongoDB servers.
public class MongoDatabaseCreator : IDatabaseCreator
- Inheritance
-
MongoDatabaseCreator
- Implements
- Inherited Members
Remarks
This class is not typically used directly from application code.
Constructors
- MongoDatabaseCreator(IMongoClientWrapper, ICurrentDbContext)
Creates and deletes databases on MongoDB servers.
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.
- 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 an 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 an no effort is made to remove just the database objects that are used by the model for this context.