Share via


IRelationalConnection.OpenAsync Method

Definition

Overloads

OpenAsync(CancellationToken)

Asynchronously opens the connection to the database.

OpenAsync(CancellationToken, Boolean)

Asynchronously opens the connection to the database.

OpenAsync(CancellationToken)

Asynchronously opens the connection to the database.

public System.Threading.Tasks.Task OpenAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member OpenAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function OpenAsync (Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

cancellationToken
CancellationToken

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

Returns

A task that represents the asynchronous operation.

Applies to

OpenAsync(CancellationToken, Boolean)

Asynchronously opens the connection to the database.

public System.Threading.Tasks.Task<bool> OpenAsync (System.Threading.CancellationToken cancellationToken, bool errorsExpected = false);
abstract member OpenAsync : System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<bool>
Public Function OpenAsync (cancellationToken As CancellationToken, Optional errorsExpected As Boolean = false) As Task(Of Boolean)

Parameters

cancellationToken
CancellationToken

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

errorsExpected
Boolean

Indicate if the connection errors are expected and should be logged as debug message.

Returns

A task that represents the asynchronous operation, with a value of true if the connection was actually opened.

Exceptions

Applies to