Method CreateDatabaseAsync
- Namespace
- MongoDB.EntityFrameworkCore.Storage
- Assembly
- MongoDB.EntityFrameworkCore.dll
CreateDatabaseAsync(IModel, CancellationToken)
Create a new database with the name specified in the connection options asynchronously.
Task<bool> CreateDatabaseAsync(IModel model, CancellationToken cancellationToken = default)
Parameters
modelIModelThe IModel that informs how the database should be created.
cancellationTokenCancellationTokenA CancellationToken that can be used to cancel this asynchronous request.
Returns
- Task<bool>
A Task that, when resolved, will be
trueif the database was created from scratch,falseif it already existed.
Remarks
If the database already exists only new collections will be created.