开发者

TransactionScope and Npgsql - Prepared Transaction Issue

开发者 https://www.devze.com 2023-04-12 05:17 出处:网络
I have following code: //... using (TransactionScope tScope = new TransactionScope()) { using (NpgsqlConnection myConnection = new NpgsqlConnection(_MyConnectionString))

I have following code:

//...
using (TransactionScope tScope = new TransactionScope())
        {
            using (NpgsqlConnection myConnection = new NpgsqlConnection(_MyConnectionString))
            {
                try
                {
                    myConnection.Open();

                    //...

                    tScope.Complete();
                }
                catch (Exception ex)
                {
                    logger.Error(ex);
                }
                finally
                {
                    myConnection.Close();
                }
            }
        }
//...

The problem is, when some error occurred transactionscope do rollback, but, on the PostgreSQL server I have prepared transaction. And applications can not work anything with database server until I delet开发者_运维问答e prepared transaction manualy.

Any solution?

BTW, I use Npgsql version: 2.0.11.91

Best regards

0

精彩评论

暂无评论...
验证码 换一张
取 消