What is a good practice on work with (nHibernate) ITransactions between several repositories?
First created a BeginTransaction() on the generic interface, but i then come to think about how will this work between the repositories? i mean if a delete things from on repository and then other things from another repository, but want’s to wrap the whole operation in a transaction.
although all the reposistories share the same ISession (handled by the DI framework) so i guess could get a ITransaction from any of the repositories and then commit it, and it will work for all the other repositories as well.
I could instead of making the whole class generic, just make each function generic, like this:
but then the interface is more or less depended on nHibernate anyway, so maybe it’s worth implementering the Unit of Work pattern after all.