Does Npgsql provider has support for TransactionScope?

前端 未结 1 1510
臣服心动
臣服心动 2021-02-09 12:59

I\'m trying to use a TransactionScope with the Npgsql provider. I found in an old question (provider for PostgreSQL in .net with support for TransactionScope) that Npgsql didn\'

1条回答
  •  -上瘾入骨i
    2021-02-09 13:54

    Npgsql does support TransactionScope and has done so for quite a while. However, at least for the moment, in order to have your connection participate in the TransactionScope you must either:

    1. Include Enlist=true in your connection string, or
    2. Call NpgsqlConnection.EnlistTransaction

    Take a look at the Npgsql unit tests around this for some examples.

    0 讨论(0)
提交回复
热议问题