I am using an object persistence framework called ECO for updating data to SQL Server. I’ve noticed that if I create a TransactionScope and then deliberately throw an exception after my first transaction has committed but before my second has committed the first database is updated and the 2nd is not.
I thought that simply creating the TransactionScope around the numerous updates is all I had to do once the distributed transaction coordinator is running on the main DB?
Can anyone think of any reason why this would per permitting a scenario where the first DB is updated but not the second?
Got it!
ECO supports the following databases…
I remembered this morning that some of these don’t support connection pooling, so on an abstract PersistenceMapper class ECO has implemented its own connection pooling. This is what was happening
As a consequence the connection is not enlisted in the current distributed transaction. Considering SqlConnection does its own pooling it was acceptable to set PersistenceMapperSqlServer.MaxPoolSize to ZERO.
Now it uses the SqlConnection component to deal with the creation/disposal of Connections, not only does that component pool the connections but it also deals with distributed transactions properly too!
I’ve written to the developers to let them know that they should mark this property obsolete.