DatabaseConnectionRunInTransaction Method (IDatabaseConnection, ActionIDatabaseConnection, TransactionMode) |
Runs the Action action in a transaction and returns the function result.
If the database is not currently in a transaction, a new transaction is created using
the provided TransactionMode and committed. Otherwise the transaction is created within
a savepoint block but not fully committed to the database until the enclosing transaction is committed.
Namespace: SQLitePCL.prettyAssembly: SQLitePCL.pretty (in SQLitePCL.pretty.dll) Version: 1.0.0.0 (1.0.0)
Syntax public static void RunInTransaction(
this IDatabaseConnection This,
Action<IDatabaseConnection> action,
TransactionMode mode
)
[<ExtensionAttribute>]
static member RunInTransaction :
This : IDatabaseConnection *
action : Action<IDatabaseConnection> *
mode : TransactionMode -> unit
Parameters
- This
- Type: SQLitePCL.prettyIDatabaseConnection
The database connection. - action
- Type: SystemActionIDatabaseConnection
The Action to run in a transaction. - mode
- Type: SQLitePCL.prettyTransactionMode
The transaction mode to use begin a new transaction. Ignored if the transaction is run
within an existing transaction.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IDatabaseConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Exception | Condition |
---|
Exception | The exception that caused the transaction to be aborted and rolled back. |
See Also