DbDataReader.GetColumnSchemaAsync(CancellationToken) 方法

定义

这是 GetColumnSchema(DbDataReader) 的异步版本。This is the asynchronous version of GetColumnSchema(DbDataReader). 提供程序应使用合适的实现进行重写。Providers should override with an appropriate implementation. 可以选择接受 cancellationTokenThe cancellationToken can optionally be honored. 默认实现调用同步 GetColumnSchema(DbDataReader) 调用并返回已完成任务。The default implementation invokes the synchronous GetColumnSchema(DbDataReader) call and returns a completed task. 如果传递到已取消 cancellationToken,则默认实现将返回已取消的任务。The default implementation will return a cancelled task if passed an already cancelled cancellationToken. GetColumnSchema(DbDataReader) 引发的异常将通过任务异常属性传递。Exceptions thrown by GetColumnSchema(DbDataReader) will be communicated via the returned Task Exception property.

public virtual System.Threading.Tasks.Task<System.Collections.ObjectModel.ReadOnlyCollection<System.Data.Common.DbColumn>> GetColumnSchemaAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetColumnSchemaAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.ObjectModel.ReadOnlyCollection<System.Data.Common.DbColumn>>
override this.GetColumnSchemaAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Collections.ObjectModel.ReadOnlyCollection<System.Data.Common.DbColumn>>
Public Overridable Function GetColumnSchemaAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of ReadOnlyCollection(Of DbColumn))

参数

cancellationToken
CancellationToken

取消指令。The cancellation instruction.

返回

Task<ReadOnlyCollection<DbColumn>>

表示异步操作的任务。A task representing the asynchronous operation.

适用于