EntityDataReader.Dispose(Boolean) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
釋放被 EntityDataReader 此消耗的資源並呼叫 Close()。
protected:
override void Dispose(bool disposing);
protected override void Dispose(bool disposing);
override this.Dispose : bool -> unit
Protected Overrides Sub Dispose (disposing As Boolean)
參數
- disposing
- Boolean
true 釋放可管理與非受管理資源; false 只釋放未管理的資源。
備註
SQL Server 會在結果串流的末尾,將儲存程序的輸出參數放在所有結果集之後。 因此,為了取得輸出參數值,應用程式必須消耗所有結果集中的所有記錄。 如果應用程式關閉 EntityDataReader 了(也會關閉 DbDataReader),輸出參數可能無法被填入。
EntityDataReader 不會隱含使用結果集以提供輸出參數。 因此,請注意以下幾點:
EntityDataReader只有在DbDataReader.NextResult明確被呼叫時才會呼叫EntityDataReader.NextResult。 如果 DbDataReader.NextResult 拋出例外,會 EntityDataReader 將其包裹在 EntityException 一個(或衍生例外)中。
Close 只會關閉 DbDataReader,且不會消耗任何待處理的記錄或結果集。
Dispose 僅處理 DbDataReader,且不消耗任何待處理的記錄或結果集。