The ObjectMapper .NET Project

Official blog of the AdFactum ObjectMapper .NET

Exception: TransactionAlreadyOpenException

Posted by Gerhard Stephan on April 21st, 2008

The TransactionAlreadyOpenException will always be thrown if you try to open an already open transaction a second time. In a simple example this exception can be forced with the following code.

            using (AdFactum.Data.ObjectMapper mapper = OBM.CreateMapper(Connection))

            {

                try

                {

                    mapper.BeginTransaction();

                    mapper.BeginTransaction(); // Second try causes the exception

                }

                catch(Exception)

                {

                    mapper.Commit();

                    throw;

                }

            }

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

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>