I'm starting to think that TransactionScope has some problem with dotConnect for Oracle 5.00.20.
I have a very simple test in which I read an object and insert another one with the same description:
Code: Select all
[TestMethod]
public void TransactionScopeWithSimpleInsert()
{
try
{
using (TransactionScope ts = new TransactionScope())
{
TSObjectContext context = null;
try
{
context = new TSObjectContext();
TestData testData =
context.TestDataSet
.First();
Guid id = Guid.NewGuid();
TestData newTestData = TestData.CreateTestData(id);
newTestData.Description = testData.Description;
context.AddToTestDataSet(newTestData);
context.SaveChanges();
}
catch (Exception)
{
throw;
}
finally
{
if (context != null)
{
context.Dispose();
}
}
ts.Complete();
}
}
catch (Exception ex)
{
Assert.Fail(ex.Message);
}
}
the same test works without any problem with SQLServer, and honestly I don't see any reason why it shouldn't work.The operation is not valid for the current state of the enlistment.
System.InvalidOperationException
at System.Transactions.EnlistmentState.ForceRollback(InternalEnlistment enlistment, Exception e)
at System.Transactions.PreparingEnlistment.ForceRollback()
at Devart.Data.Oracle.h.a(PreparingEnlistment A_0)
at System.Transactions.VolatileEnlistmentPreparing.EnterState(InternalEnlistment enlistment)
at System.Transactions.VolatileEnlistmentActive.ChangeStatePreparing(InternalEnlistment enlistment)
at System.Transactions.TransactionStateVolatilePhase1.EnterState(InternalTransaction tx)
at System.Transactions.TransactionStatePhase0.EnterState(InternalTransaction tx)
at System.Transactions.TransactionStateActive.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
at TestDevArtTransatcionScope.TestSuite.TransactionScopeTestCase.TransactionScopeWithSimpleInsert()
Why it fails with Oracle?
This is a very simple test, am I wrong somewhere?
Thanks.