This probably has been discussed before but here is my go at it…
When using transaction scope, the CSLA creates an instance of the TransactionScope class using its default constructor which in turn uses a default timeout value. The problem with the default timeout value is that is an arbitrary value which sometimes is good enough and sometimes is not.
This creates nondeterministic application behavior since an identical operation may sometimes succeed and sometimes fail depending on unpredictable factors such as server load or network traffic. For example, if the server load is low the operation will succeed but if the server load is high the exact same operation will fail because TransactionScope times out. Unfortunately, there is nothing we can do about this because the CSLA does not allow the timeout to be adjusted.
In order to make the transaction scope feature truly useful the CSLA should either default the timeout to the max value possible and let connection or command itself time out (have not tried this but my guess is that those two should be able to handle timeouts) or add functionality to the TransactionalAttribute so that we can specify our own timeout.
Is this a sensible request or am I approaching this all wrong?
Transaction attribute already supports timeout with along with isolation level. You can also set defaults for both globally in web.config / app.config files.
This is great news, I guess I should have looked at the latest CSLA version before I started posting. We are using version 18.104.22.168 and unless I am mistaken that particular version does not include such feature.
Here you go
<add key="CslaDefaultTransactionIsolationLevel" value="ReadCommitted"/> <add key="CslaDefaultTransactionTimeoutInSeconds" value="300"/>
You can also specify both on Transactional attribute itself.
Looking at the notes, it is in 4.5. You can probably port it over to older version, but I do not think there are any breaking changes from 4.2 to 4.5
There are a lot of *.config settings. I guess a quick reference is needed...
Copyright (c) Marimer LLC