I'm working (maintaining) on a dll assembly that acts as a Data Access Layer, there are many methods that requires transaction handling, many other do not, it's a currently "functional" dll, without any transaction handling method, I need to add it, so I'm looking for an easy way to add a transaction handler.
I'm wondering if is it possible to use AOP to create a decorator that I can add to the methods that requires a transaction.
I would like to have something like this:
[Transaction]
void MyDbMethod()
{
//DoSomething
myContext.SaveChanges();
}
For the EF model definition I'm using Code First, the current project uses Unity framework for some other DI tasks, can that framework be used for this?