I feel awkward writing code in my entire MVC application.
using(var tx = new TransactionScope()){
blah...
tx.Complete()
}
I would like to make this DRYer somehow.
I thought of several different options for this.
- An action filter to declaratively designate certain actions as transactional.
- Override OnActionExecuting in the base class of the controller and make all transactions transactions in one snapshot.
Is there one of these ideas? Any prey I should pay attention to? The second option seems to be a good way to get a lot of dead ends.
Oh yes, I also use StructureMap and the factory user controller to inject fingerprints into my controllers if anyone knows of some tricks for injecting transactions this way.