Have a typed dataset with several related tables, and relations defined between those tables. As I process a datafeed, I'm adding, modifying, and removing records, then calling update on each table.
Requests Reapprovals UserRole
RequestId ----- RequestId ----- RoleId
Reason RoleId ----/ UserId
The reason for using a typed dataset is that I have to check existing data to determine whether I'm adding, modifying, or removing records... so I need the full dump of everything I'm working with (the alternative would be 10,000 queries against the database as I process the records one by one).
I want transactional support, but I'm not seeing a way to do it with typed datasets. For example, I'm creating a new request when I create a new reapproval. But if the reapproval fails to update, I don't want to keep the request.
Putting the update calls under a TransactionScope
would mean that if any record fails, they all fail. Not what I want.
How would I commit or roll back related rows in a typed dataset?