Can I use transactions with a datacontext, so that I can rollback the state of the context after an error? And if so, how does that work?
I use them in testing all the time :)
try { dc.Connection.Open(); dc.Transaction = dc.Connection.BeginTransaction(); dc.SubmitChanges(); } finally { dc.Transaction.Rollback(); }
UPDATE
This will ALWAYS rollback after the fact. I use this in testing.