共用方式為


EntityCommand.ExecuteReaderAsync 方法 (CommandBehavior, CancellationToken)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

非同步執行命令並傳回讀取結果的資料讀取器。 只能在 CommandType.CommandText 上呼叫 (否則,請使用標準 Execute* 方法)

命名空間:  System.Data.Entity.Core.EntityClient
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
<DebuggerStepThroughAttribute> _
Public Overridable Function ExecuteReaderAsync ( _
    behavior As CommandBehavior, _
    cancellationToken As CancellationToken _
) As Task(Of EntityDataReader)
'用途
Dim instance As EntityCommand 
Dim behavior As CommandBehavior 
Dim cancellationToken As CancellationToken 
Dim returnValue As Task(Of EntityDataReader)

returnValue = instance.ExecuteReaderAsync(behavior, _
    cancellationToken)
[DebuggerStepThroughAttribute]
public virtual Task<EntityDataReader> ExecuteReaderAsync(
    CommandBehavior behavior,
    CancellationToken cancellationToken
)
[DebuggerStepThroughAttribute]
public:
virtual Task<EntityDataReader^>^ ExecuteReaderAsync(
    CommandBehavior behavior, 
    CancellationToken cancellationToken
)
[<DebuggerStepThroughAttribute>]
abstract ExecuteReaderAsync : 
        behavior:CommandBehavior * 
        cancellationToken:CancellationToken -> Task<EntityDataReader> 
[<DebuggerStepThroughAttribute>]
override ExecuteReaderAsync : 
        behavior:CommandBehavior * 
        cancellationToken:CancellationToken -> Task<EntityDataReader> 
public function ExecuteReaderAsync(
    behavior : CommandBehavior, 
    cancellationToken : CancellationToken
) : Task<EntityDataReader>

參數

傳回值

類型:System.Threading.Tasks.Task<EntityDataReader>
表示非同步作業的工作。工作結果包含 EntityDataReader 物件。

例外狀況

例外狀況 條件
InvalidOperationException

針對預存程序命令,如果為實體集合結果以外的任何物件呼叫

請參閱

參考

EntityCommand 類別

ExecuteReaderAsync 多載

System.Data.Entity.Core.EntityClient 命名空間