Repository Pattern vs DAL

后端 未结 12 2084
Happy的楠姐
Happy的楠姐 2020-12-02 04:05

Are they the same thing? Just finished to watch Rob Connery\'s Storefront tutorial and they seem to be similar techinques. I mean, when I implement a DAL object I have the G

12条回答
  •  渐次进展
    2020-12-02 04:30

    My personal opinion is that it is all about mapping, see: http://www.martinfowler.com/eaaCatalog/repository.html. So the output/input from the repository are domain objects, which on the DAL could be anything. For me that is an important addition/restriction, as you can add a repository implementation for a database/service/whatever with a different layout, and you have a clear place to concentrate on doing the mapping. If you were not to use that restriction and have the mapping elsewhere, then having different ways to represent data can impact the code in places it shouldn't be changing.

提交回复
热议问题