Ok, i found a solution.
Scenario:
I have two base classes for my Business Layer, BaseBLL
and BaseListBLL
. Each of these classes provided a method that calls an astract method that must be implemented in you concrete class. These classes started a TransactionScope
before handing off to the abstract class to perform tasks like update or insert.
Note: After the BaseListBLL starts off a TransactionScope
it calls the method in the BaseBLL
that also starts it's own transaction. This is because, we'll be inserting or updating a list of classes derived from the BaseBLL
which all together are contained in a class derived from BaseListBLL
.
Now for example if we are to update a role in the roles table only one transaction would be started. But now the complexity comes when we have a role object having another class that derives directly from the BaseListBLL
.
A transaction would be started for the list first and another for each BaseBLL
object in the list to do all the insert or update.
So now, after the first insert, the error:
Error: Time-out interval must be less than 2^32-2. Parameter name: dueTm
is thrown.
What i did was
For the list class, i set the TranscationScope
object this way:
TransactionScope ts = new TransactionScope(TransactionScopeOption.Suppress)
and for the other class
TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue)
The conclusion i have derived is that the error is being thrown because i was using the same transaction created by the BaseBLL
derived class from the list. I had to suppress the ambient transaction when it was time to do an update of the list of items.
I hope this helps someone else.