Issue Details (XML | Word | Printable)

Key: DNET-764
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Frédéric Delaporte
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
.NET Data provider

Support lack of ambient transaction when auto-enlisting is activated

Created: 28/May/17 05:45 PM   Updated: 24/Oct/17 02:55 PM
Component/s: ADO.NET Provider
Affects Version/s:
Fix Version/s:

Issue Links:

 Description  « Hide
When auto-enlistment is enabled, opening a Firebird connection without an ongoing ambient system transaction fails with error:
System.InvalidOperationException : There is no active TransactionScope to enlist transactions.

Quite self explanatory. But this behavior is exclusive to Firebird and quite unexpected for users of other database connections, and also unexpected according to MSDN about auto-enlistment:

> A connection object will automatically enlist in an existing distributed transaction if it determines that a transaction is active, which, in System.Transaction terms, means that Transaction.Current is not null. Automatic transaction enlistment occurs when the connection is opened. It will not happen after that even if a command is executed inside of a transaction scope.

Usually, enabling auto-enlistment does not mandate an active transaction for opening connection. The connection simply does not enlist to anything when opened if there are no active transaction at that time. (Thankfully, since most other db connections have auto-enlistment enabled by default.)

For reference, here is the list of other connections which I have tested and support opening with auto-enlistment enabled and lack of ambient transaction: SqlConnection, SQLiteConnection, SqlCeConnection, OdbcConnection, OracleConnection (managed & unmanaged), NpgsqlConnection, MySqlConnection.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Frédéric Delaporte added a comment - 24/Oct/17 02:55 PM
Thanks, tested with NHibernate test suit and 6.0.0-alpha2.