Code: Select all
[TestMethod]
public void TestMaxNumberOfObjectContetxtInTransactionScope()
{
using (TransactionScope ts =
this.GetTransactionScope(TransactionScopeOption.Required, IsolationLevel.ReadCommitted))
{
for (int i = 0; i < 33; i++)
{
using (TSObjectContext context = new TSObjectContext())
{
Guid id = Guid.NewGuid();
string description = Guid.NewGuid().ToString();
TestData newTestData = TestData.CreateTestData(id);
newTestData.Description = description;
context.AddToTestDataSet(newTestData);
context.SaveChanges();
}
}
ts.Complete();
}
}
in direct=true mode it works (and it works even with a higher number of times: 200, 500, ...).
in direct=false mode it doesn't work: the maximum number of times is 32 (why 32???) to work properly
The error I get is: ORA-02045: too many local sessions participating in global transaction.
the connection string in direct=false mode refers to a configured service in tsnames.ora file (Oracle client configuration).
Why a so remarkable difference between the two?
I think it's unacceptable: the database is phisically the same, and there are scenarios in which i cannot use the direct=true connection mode (for example an Oracle RAC configuration in load balance, that needs a connection via tsnames.ora with a particular configuration).
I use the latest library (5.00.26).