jonpryor / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
0 stars 0 forks source link

Does DbLinq support transaction? #293

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I want to reject the changes in my application (using MySQL), but I found the 
Transaction.Rollback() was not supported, and I've tried to use Refresh, and 
GetChangeSet().Updates.Clear(), neither of them worked for me.
2.Is there any workaround?

Original issue reported on code.google.com by liuxin...@gmail.com on 17 Nov 2010 at 8:28

GoogleCodeExporter commented 9 years ago
Yes you can but you have to handle it a bit manually:

var ctx = new DbLinqContext();

// Begin transaction:
ctx.Transaction = ctx.Connection.BeginTransaction()

// Do you edits, inserts, deletes ...
// ...
ctx.SubmitChanges();

// Commit transaction:
ctx.Transaction.Commit();

// Or rollback:
ctx.Transaction.Rollback();

Original comment by abe.gill...@gmail.com on 29 Nov 2010 at 4:36