This project is read-only.

How to use Transaction

Apr 14, 2013 at 4:00 AM
Edited Apr 14, 2013 at 4:06 AM
Well, it looks greate and really easy to use. But I still met some problem in Transactions.
( Well, as a Chinese, my English is poor too... So please excuse my confusing essay... )

After I did some operation and rollbacked it, I found the database become invalid :
var a = new ClassA() { Sth = 101 };
fac.Store( new ClassA() { Sth = 102 } ); // throw "NDatabase has thrown an Exception Error:1005:ODB session has been rollbacked (@1)"
What's is the correct way to use Transaction?

Is there any way to use several transactions in the same time?
I found the API in IOdb about transactions are just method Commit and Rollback. So is it possible to use several transactions in the same time?
( I'm sorry I didn't do any tries because of the problem 1 )

Apr 14, 2013 at 5:47 PM
here you have a documentation page about transactions - please make sure you refreshed the page (so you see the example code there - cached old version doesn't have it).

yes, after rollback you need to reopen NDatabase (OdbFactory.Open) for now, if you will try to store something after rollback, the OdbRuntimeException will be thrown. If there is any reason why that should be changed, pls add the ticket in Issue Tracker.

Nope, NDatabase supports only one opened transaction.

Apr 18, 2013 at 4:19 AM
On, really thanks!
And, I hope those problem (especially Ad1) may get improved, you know, reopen a database need lots of resource.
Really thanks!