I did read this article but that does not help because there are 2 db's are involved and it is a Distributed Transaction.
http://www.devart.com/blogs/dotconnect/ ... art-3.html
My code is somewhat like below.
- Code: Select all
using (var ts = new TransactionScope())
using (var context = new MyContext())
for (int i = 0; i < 40; i++)
var order = context.Orders.Where(a => a.name = 'xxx').Single();
Even though I am creating the "Context" outside my loop(unlike the example in the link above), the code still fails with the "too many local sessions" error.
Also, I noticed that every query "context.Orders.Where(...)" is enlisted as a new Transaction. I am using Entity Framework and not Linq to Sql. So the above code breaks at 20 iterations.
Can anyone help with this? What are my options now?