Why use Repository Pattern or please explain it to me?

前端 未结 8 1798
隐瞒了意图╮
隐瞒了意图╮ 2021-01-30 01:10

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

8条回答
  •  抹茶落季
    2021-01-30 01:18

    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).

提交回复
热议问题