Using TransactionScope returns no data or gives exception

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
freakshow
Posts: 12
Joined: Mon 28 Jul 2008 12:38
Location: Oslo, Norway

Using TransactionScope returns no data or gives exception

Post by freakshow » Tue 03 Mar 2009 10:11

I am using dotConnect for Oracle 5.0.22.0. This scenario does not work in either direct or non-direct mode.

Background: Want to do integration tests

Scenario: Create a new record, save changes and verify the result (read it back).

The scenario works as expected when I am not using TransactionScope.

In direct mode I get no record back.
In non-direct mode I get an ORA-01453 error message (SET TRANSACTION must be first statement of transaction)

Code: Select all

using (TransactionScope trans = new TransactionScope())
{
	using (Entities entities = new Entities())
	{
	    var qry = from e in entities.Table1
		      select e;
	    foreach (Table1 record in qry)
	    {
		Console.WriteLine(record.Id);
	    }
	    Console.WriteLine("-----------------------");

	    Table1 newRecord = Table1.CreateTable1("SOMEID");
	    entities.AddToTable1(newRecord);
	    entities.SaveChanges();

	    var qry2 = from e in entities.Table1
		      select e;
	    
	    foreach (Table1 record in qry)
	    {
	    	Console.WriteLine(record.Id);
	    }
	    Console.WriteLine("-----------------------");
	}
}

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 03 Mar 2009 14:39

This problem is associated with transactions Isolation level.
It is already fixed in the recent Beta of dotConnect.
As a workaround you can try creating TransactionScope in the following way:

Code: Select all

     TransactionOptions to = new TransactionOptions();
      to.IsolationLevel = IsolationLevel.ReadCommitted;
      using (TransactionScope trans = new TransactionScope(TransactionScopeOption.Required, to))

freakshow
Posts: 12
Joined: Mon 28 Jul 2008 12:38
Location: Oslo, Norway

Does not work in direct mode

Post by freakshow » Tue 10 Mar 2009 08:07

Thanks, but this does not work in Direct mode (it works in non-direct mode).

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 10 Mar 2009 13:32

We are investigating the Direct mode problem.

freakshow
Posts: 12
Joined: Mon 28 Jul 2008 12:38
Location: Oslo, Norway

Any updates

Post by freakshow » Fri 17 Apr 2009 10:53

Any updates for this?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 17 Apr 2009 12:42

Please try to reproduce the problem using the latest dotConnect for Oracle 5.20.27 Beta build. We have added some fixes to it.
If the problem persists, please send us (support * devart * com, subject "Oracle Transaction Scope Direct problem") a small test project illustrating the error.

Post Reply