AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Exception: NoOpenTransactionException

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);

               OBM.Commit(mapper, nested);


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>