I am learning repository pattern and was reading Repository Pattern with Entity Framework 4.1 and Code First
and Generic Repository Pattern - Entity Framework, ASP.NET MVC and Unit Testing Triangle
about how they implement the repository pattern with Entity Framework.
•Hide EF from upper layer
•Make code better testable
..//query foo from entity framework
.. //add foo to entity framework
One thing is to increase testability and have a loose coupling to underlying persistance technology. But you will also have one repository per aggregate root object (eg. an order can be an aggregate root, which also have order lines (which are not aggregate root), to make domain object persistance more generic.
It's also makes it much easier to manage objects, because when you save an order, it will also save your child items (which can be order lines).