Method CreateDatabaseAsync
- Namespace
- MongoDB.EntityFrameworkCore.Storage
- Assembly
- MongoDB.EntityFrameworkCore.dll
CreateDatabaseAsync(IDesignTimeModel, CancellationToken)
Create a new database with the name specified in the connection options asynchronously.
Task<bool> CreateDatabaseAsync(IDesignTimeModel model, CancellationToken cancellationToken = default)
Parameters
modelIDesignTimeModelThe IDesignTimeModel 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 true if the database was created from scratch, false if it already existed.
Remarks
If the database already exists only new collections will be created.