Table of Contents

Method CanConnectAsync

Namespace
MongoDB.EntityFrameworkCore.Storage
Assembly
MongoDB.EntityFrameworkCore.dll

CanConnectAsync(CancellationToken)

Determines whether or not the database is available and can be connected to.

public Task<bool> CanConnectAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<bool>

true if the database is available; false otherwise.

Remarks

Note that being able to connect to the database does not mean that it is up-to-date with regard to schema creation, etc.

Exceptions

OperationCanceledException

If the CancellationToken is canceled.