Issue Details (XML | Word | Printable)

Key: DNET-439
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Jiri Cincura
Reporter: Hélio Tibagí de Oliveira
Votes: 1
Watchers: 2

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

TransactionScope not working with EnlistTransaction

Created: 19/Jun/12 06:58 PM   Updated: 06/Sep/18 06:36 PM
Component/s: ADO.NET Provider
Affects Version/s: None
Fix Version/s: None

Server: Firebird V1.5.3.4870, Debian linux
Client: Provider 2.7.7, .NET 4.0

 Description  « Hide
Assuming the table "TEST" created in Firebird and SQLServer using the statement below:

Then, the following code in a console application connecting to the SQLServer:
SqlConnection connSQLServer = new SqlConnection("Data Source=localhost;Initial Catalog=DATABASE;User ID=sa;Password=mypassword");

using (TransactionScope scope = new TransactionScope())
    Int32 affectedLines = new SqlCommand("INSERT INTO TEST (INTEGER_COLUMN) VALUES (1)", connSQLServer).ExecuteNonQuery();
    Console.WriteLine(affectedLines); // ---> #1 line affected

Int32 persistedLines = (Int32)new SqlCommand("SELECT COUNT(*) FROM TEST", connSQLServer).ExecuteScalar();

Console.WriteLine(persistedLines); // ---> #0 line persisted

Running the same code in Firebird:
FbConnection connFirebird = new FbConnection("User=SYSDBA;Password=masterkey;Database=myserver:backup02.fdb;Dialect=3;Charset=WIN1252;");

using (TransactionScope scope = new TransactionScope())
    Int32 affectedLines = new FbCommand("INSERT INTO TEST (INTEGER_COLUMN) VALUES (1)", connFirebird).ExecuteNonQuery();
    Console.WriteLine(affectedLines);// ---> #1 line affected

Int32 persistedLines = (Int32)new FbCommand("SELECT COUNT(*) FROM TEST", connFirebird).ExecuteScalar();

Console.WriteLine(persistedLines);// ---> #1 line persisted

The rollback is done successfully in SQLServer, but not in Firebird. Can you fix this problem?

Thanks in advance.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Hélio Tibagí de Oliveira added a comment - 19/Jun/12 07:34 PM
I also tested this same code in Firebird 2.5.1 and had the same result.

Thiago Araújo added a comment - 06/Sep/18 06:36 PM
Entity Framework Core don't have "Level transaction" and we can't implement ReadUncommited transactions. Reading about it in Microsoft documentation I saw we need to use TransactionScope.