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("-----------------------");
}
}