January 2018
Beginner to intermediate
312 pages
7h 22m
English
All the code so far has been of the form “one aggregate = one transaction.” But in many situations, we have a number of things that need to be saved together atomically—all or nothing.
Some data stores support transactions as part of their API. Multiple calls to the service can be enlisted in the same transaction, like this:
| | let connection = new SqlConnection() |
| | let transaction = connection.BeginTransaction() |
| | |
| | // do two separate calls to the database |
| | // in the same transaction |
| | markAsFullyPaid connection invoiceId |
| | markPaymentCompleted connection paymentId |
| | |
| | // completed |
| | transaction.Commit() |
Some data stores only support transactions as long as everything is done in a single connection. In practice, that means ...
Read now
Unlock full access