Edit

Share via


DbDataReader.GetSchemaTableAsync(CancellationToken) Method

Definition

This is the asynchronous version of GetSchemaTable(). Providers should override with an appropriate implementation. The cancellationToken can optionally be honored. The default implementation invokes the synchronous GetSchemaTable() call and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Exceptions thrown by GetSchemaTable() will be communicated via the returned Task Exception property.

public virtual System.Threading.Tasks.Task<System.Data.DataTable?> GetSchemaTableAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetSchemaTableAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.DataTable>
override this.GetSchemaTableAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Data.DataTable>
Public Overridable Function GetSchemaTableAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of DataTable)

Parameters

cancellationToken
CancellationToken

The cancellation instruction.

Returns

A task representing the asynchronous operation.

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by GetSchemaTable().

Applies to