EF4 - Repositories and Unit of Work?

I can't say that there is a consensus out there, but on top of my having spoken to many architects about the topic, I have spent a considerable amount of time evaluating this very thing. What I've come up with is that you want to keep your object management (Repositories) and transactions (UnitOfWork) loosely coupled and independent of each other. Your Repository should be able to run without having to use a transaction and vise versa.

In terms of its relation to a Repository, a Unit of Work is really just a wrapper for a transaction. In your case, you will probably be wrapping EF2 Repository operations using the TransactionScope implementation. In our framework, we've put transaction management into a DataServices namespace/project and our base Repository classes in an ObjectAccess namespace/project.

From there we created an EF2 implementation for both the Repository operations and the Unit of Work operations. I can't give you the source, but basically what I did was the following.

Given the following pages I'd say that the MS consensus is UnitOfWork exposing repositories.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions