RelationalExecutionStrategyExtensions.ExecuteInTransaction 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| ExecuteInTransaction(IExecutionStrategy, Action, Func<Boolean>, IsolationLevel) |
執行交易中指定的操作。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。 |
| ExecuteInTransaction<TResult>(IExecutionStrategy, Func<TResult>, Func<Boolean>, IsolationLevel) |
執行交易中指定的操作並回傳結果。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。 |
| ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>, IsolationLevel) |
執行交易中指定的操作並回傳結果。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。 |
| ExecuteInTransaction<TState>(IExecutionStrategy, TState, Action<TState>, Func<TState,Boolean>, IsolationLevel) |
執行交易中指定的操作。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。 |
ExecuteInTransaction(IExecutionStrategy, Action, Func<Boolean>, IsolationLevel)
執行交易中指定的操作。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。
public static void ExecuteInTransaction(this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Action operation, Func<bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Action * Func<bool> * System.Data.IsolationLevel -> unit
<Extension()>
Public Sub ExecuteInTransaction (strategy As IExecutionStrategy, operation As Action, verifySucceeded As Func(Of Boolean), isolationLevel As IsolationLevel)
參數
- strategy
- IExecutionStrategy
執行時將採用的策略。
- operation
- Action
代表可執行操作的代理。
- isolationLevel
- IsolationLevel
用於交易的隔離層級。
例外狀況
設定的重試次數後,操作仍未成功。
備註
更多資訊與範例請參見 連線韌性與資料庫重試 。
適用於
ExecuteInTransaction<TResult>(IExecutionStrategy, Func<TResult>, Func<Boolean>, IsolationLevel)
執行交易中指定的操作並回傳結果。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。
public static TResult ExecuteInTransaction<TResult>(this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, Func<TResult> operation, Func<bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * Func<'Result> * Func<bool> * System.Data.IsolationLevel -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TResult) (strategy As IExecutionStrategy, operation As Func(Of TResult), verifySucceeded As Func(Of Boolean), isolationLevel As IsolationLevel) As TResult
類型參數
- TResult
的回傳類型 operation。
參數
- strategy
- IExecutionStrategy
執行時將採用的策略。
- operation
- Func<TResult>
一個代表可執行操作的代理,回傳型別 TResult為 的結果。
- isolationLevel
- IsolationLevel
用於交易的隔離層級。
傳回
手術的結果。
例外狀況
設定的重試次數後,操作仍未成功。
備註
更多資訊與範例請參見 連線韌性與資料庫重試 。
適用於
ExecuteInTransaction<TState,TResult>(IExecutionStrategy, TState, Func<TState,TResult>, Func<TState,Boolean>, IsolationLevel)
執行交易中指定的操作並回傳結果。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。
public static TResult ExecuteInTransaction<TState,TResult>(this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Func<TState,TResult> operation, Func<TState,bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Func<'State, 'Result> * Func<'State, bool> * System.Data.IsolationLevel -> 'Result
<Extension()>
Public Function ExecuteInTransaction(Of TState, TResult) (strategy As IExecutionStrategy, state As TState, operation As Func(Of TState, TResult), verifySucceeded As Func(Of TState, Boolean), isolationLevel As IsolationLevel) As TResult
類型參數
- TState
州的類型。
- TResult
的回傳類型 operation。
參數
- strategy
- IExecutionStrategy
執行時將採用的策略。
- state
- TState
將要傳遞給行動的狀態。
- operation
- Func<TState,TResult>
一個代表可執行操作的代理,回傳型別 TResult為 的結果。
- isolationLevel
- IsolationLevel
用於交易的隔離層級。
傳回
手術的結果。
例外狀況
設定的重試次數後,操作仍未成功。
備註
更多資訊與範例請參見 連線韌性與資料庫重試 。
適用於
ExecuteInTransaction<TState>(IExecutionStrategy, TState, Action<TState>, Func<TState,Boolean>, IsolationLevel)
執行交易中指定的操作。 允許在提交過程中發生錯誤時檢查交易是否已被回滾。
public static void ExecuteInTransaction<TState>(this Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy strategy, TState state, Action<TState> operation, Func<TState,bool> verifySucceeded, System.Data.IsolationLevel isolationLevel);
static member ExecuteInTransaction : Microsoft.EntityFrameworkCore.Storage.IExecutionStrategy * 'State * Action<'State> * Func<'State, bool> * System.Data.IsolationLevel -> unit
<Extension()>
Public Sub ExecuteInTransaction(Of TState) (strategy As IExecutionStrategy, state As TState, operation As Action(Of TState), verifySucceeded As Func(Of TState, Boolean), isolationLevel As IsolationLevel)
類型參數
- TState
州的類型。
參數
- strategy
- IExecutionStrategy
執行時將採用的策略。
- state
- TState
將要傳遞給行動的狀態。
- operation
- Action<TState>
代表可執行操作的代理。
- isolationLevel
- IsolationLevel
用於交易的隔離層級。
例外狀況
設定的重試次數後,操作仍未成功。
備註
更多資訊與範例請參見 連線韌性與資料庫重試 。