| ControllerBaseDoInTransactionT Method (FuncSqlConnection, SqlTransaction, T, Boolean) |
Executes an action in a transaction and returns the result.
Connection and Transaction are passed to delegate, to allow passing to other controllers
If no current connection and/or transaction exists, it will establish it and commit and close it afterwards.
An existing connection/transaction will be reused. Set forceNew to true to ensure new connection and transaction
Inside the action, the connection is available as
DbConnection and
the transaction as
DbTransaction.
Namespace:
Omada.OE.AppLogic
Assembly:
Omada.OE.AppLogic (in Omada.OE.AppLogic.dll) Version: 15.0.0.0
Syntaxpublic virtual T DoInTransaction<T>(
Func<SqlConnection, SqlTransaction, T> action,
bool forceNew = false
)
Parameters
- action
- Type: SystemFuncSqlConnection, SqlTransaction, T
- forceNew (Optional)
- Type: SystemBoolean
Set to true to ensure new connection and transaction instead of reusing the one already on controller
Type Parameters
- T
Return Value
Type:
T
See Also