You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bfa248b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/content/core/crud.fsx
+63-1Lines changed: 63 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -180,7 +180,69 @@ ctx.SubmitUpdates() // no record is added
180
180
181
181
(**
182
182
183
-
Inside SubmitUpdate the transaction is created by default TransactionOption, which is Required: Shares a transaction, if one exists, and creates a new transaction if necessary. So, if you have query-operation before SubmitUpdates, you should create your own transaction to wrap these into the same transaction.
183
+
### Transactions and isolation level
184
+
185
+
`SubmitUpdates` / `SubmitUpdatesAsync` wrap the write in a `TransactionScope` created with
186
+
`TransactionScopeOption.Required`: it *joins* an ambient transaction if one already exists, otherwise
187
+
it starts a new one. Only the submit is wrapped — your queries/reads are **not** put in a
188
+
transaction, so reads carry no locking overhead.
189
+
190
+
Because of `Required`, the way to make a *read-then-write* atomic (read some rows, decide, then write)
191
+
is to open your **own** transaction around both the reads and the `SubmitUpdates`, and that scope's
SQL Engine operations may differ from .NET ones, for example `Math.Round` in .NET (banker's rounding).
330
+
329
331
Microsoft SQL Server doesn't have Greatest and Least functions, so that will be done via nested SQL clause: (select max(v) from (values (x), (y)) as value(v))
330
332
It might also not be standard ODBC, but it should work e.g. on Amazon Redshift.
0 commit comments