Posted by Gerhard Stephan on April 17th, 2008
The NoOpenTransactionException will always be thrown if a Save-Method is called without opening a Transaction first.
public void TestNoOpenTransactionException()
Buying buying = new Buying(5, "Hotdogs");
using (AdFactum.Data.ObjectMapper mapper = OBM.CreateMapper(Connection))
// A NoOpenTransactionException will be thrown, because no transaction has been opened.
To prevent this exception you have to call the BeginTransaction Method. It’s recommended to use the BeginTransaction of the OBM Helper class in order to handle nested transactions.
nested = OBM.BeginTransaction(mapper);