I was pulling data from a web service and splitting the information across multiple tables in my database, so I wanted to rollback the entire operation if one of the saves failed. SubSonic 3 can handle transactions and I did get it working as needed, but I encountered a couple of issues along the way.
- When I attempted to save to the second table I was getting an error about a DataReader already being open. Like the guy who reported the same problem here, I was using SubSonic 3.0.03. I replaced it with version 18.104.22.168, which worked fine.
The example in the SubSonic documentation on transactions shows the
TransactionScopecode nested inside the
SharedDbConnectionScopecode. I found that with this setup there was no rollback on error, and the DB tables were being updated. As indicated here and here, the nesting needs to be the other way round.