Table of Contents

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.

public Task<bool> CreateDatabaseAsync(IDesignTimeModel model, CancellationToken cancellationToken = default)

Parameters

model IDesignTimeModel

The IDesignTimeModel that informs how the database should be created.

cancellationToken CancellationToken

A 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.