I am looking for an example of how to use some generic transaction abstraction, making it easy to switch Repository implementations between e.g. NHibernate or Entity Framework.
(Regarding the mentioned "Repository" I am talking about a DDD repository, and if the reader may not be aware of the DDD repository, then please see
http://en.wikipedia.org/wiki/Domain-driven_design )
I believe a solution might involve System.Transactions.TransactionScope or the Spring.AOP Transaction attribute.
If possible, I would like to find some good example code illustrating how client code can be truly independing of the current repository implementation, not needing to be modified when replacing the repository implementation.
An interesting example would be an application layer method which instantiates two Repository implementations (probably by using some dependency injection framework to avoid the coupling to concrete repository implementation classes) which both will invoke some persisting code (Inserts/Updates/Deletes) and then the client code in the application layer should either commit the changes explicit (or implicit commit/rollback with Spring AOP).
/ Tomas