Does LINQ to SQL provider for Oracle support transactions?

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
rdrenker
Posts: 3
Joined: Tue 22 Dec 2009 21:23

Does LINQ to SQL provider for Oracle support transactions?

Post by rdrenker » Tue 22 Dec 2009 21:44

I've been trying trying to create a transaction to commit / rollback stored procedure calls using the LINQ to SQL provider, but haven't been able to get it work.

I've been trying this type of code without success:

--------

using (TestDataContext context = new TestDataContext(ConnectionString))
{
context.Connection.Open();
context.Transaction = context.Connection.BeginTransaction();

context.SomeSprocToInsertData(data1, data2, data3);

context.Transaction.Rollback();
}
-------


The sproc runs, the data is inserted...And the Rollback is completely ignored.

Are transactions supported? If so, what am I doing wrong?

Thanks,

Roy

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

Post by AndreyR » Wed 23 Dec 2009 13:53

This behaviour is caused by the fact that every procedure call is executed on the new connection by default.
It is designed for the performance reasons.
As a solution, you can simply set the DataContext.MaxUsedConections property to 1.
This will force the usage of the single connection, and the transaction will be rolled back.

Post Reply