.net – Transactionscope not working on SQLite in Subsonic

subsonicvb.net

I have trouble using the transactionscope on SQLite, i am using the following code. Changes are still commited to the database while i don't call the ts.Complete() function.

Using ts As New System.Transactions.TransactionScope()  
  Using sharedConnectionScope As New SubSonic.SharedDbConnectionScope()
  ' Do your individual saves here' 
  If all OK      
    ts.Complete()   
  End Using
End Using

Best Answer

If I recall correctly, you're going to need to call BeginTransaction and EndTransaction somewhere in there to tell SQLite that you're entering and subsequently leaving a transaction block--if I recall correctly, wrapping a (using transaction As IDbCommand.BeginTransaction ()) around any transaction-based code is necessary (though I haven't done ADO.NET in a while).