RelationalConnection.OpenAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OpenAsync(CancellationToken, Boolean) |
Asynchronously opens the connection to the database. |
OpenAsync(CancellationToken) |
Asynchronously opens the connection to the database. |
OpenAsync(CancellationToken, Boolean)
Asynchronously opens the connection to the database.
public virtual 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>
override this.OpenAsync : System.Threading.CancellationToken * bool -> System.Threading.Tasks.Task<bool>
Public Overridable 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.
Implements
Exceptions
If the CancellationToken is canceled.
Applies to
OpenAsync(CancellationToken)
Asynchronously opens the connection to the database.
public virtual System.Threading.Tasks.Task OpenAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member OpenAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OpenAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable 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.
Implements
Applies to
Entity Framework