I have the following structure in the program:
Using transaction As New TransactionScope()
'Make some changes to the data
...
db.SubmitChanges()
'Make some other changes to the data
...
db.SubmitChanges()
transaction.Complete()
End Using
Will the changes be actually saved to the database when each of SubmitChanges() is called, or only transaction.Complete() will physically save them? I mean I don’t want the intermediate changes made by 1 user to be visible to others.
SubmitChanges will send the DML statements. Commit will commit the transaction. While the transaction is not committed, other readers will not see your changes. You have no risk of saving partial changes or even making them visible for a shot period of time. You can call SubmitChanges multiple times. Without an explicit transaction SubmitChanges will use one internally.