Db.Scope(Action)
or (new Transaction(...)).Scope(Action)
and attach it to a view-model.Db.Transact
and Db.TransactAsync
, as described in the Using Transactions page.transaction.Scope(Action)
at the same time, an exception will be thrown.Db.Scope
that takes a delegate to be executed as parameter. The transaction will then attach to the view-model when the (view-model) object is instantiated.Handle
function or when it otherwise operates on the object set in the Data
property, it will first set the current transaction scope to the transaction set in the Transaction
property in the view-model or its nearest parent view-model.Json
, the transaction can attach manually.CurrentPage
property was already instantiated./email-client/email/{emailId}
will use the transaction created in the first handler.Handle.Get("/email-client/email/{?}", ...)
would also declare a scope it will still use the same transaction as created by the caller, GET("/email-client/new-email", ...)
.Transaction.Commit()
and Transaction.Rollback()
.Transaction.Commit()
commits changes to the database which means that they will become visible for other transactions.Transaction.Rollback()
rolls back the state of the view-model. For example, with a commit that's immidiately followed by a rollback, no changes will roll back. Consider this scenario instead:Email
that's created would roll back and the state of the view-model would return to the previous commit.Commit
and Rollback
to allow the user to save or cancel change like in the following example:Self.GET
calls that might have responses from other apps.ScErr4287
is thrown when a long-running transaction that's not attached to a JSON object writes to the database without committing or rolling back at the end of the scope.