What is the difference between the Data Mapper, Table Data Gateway (Gateway), Data Access Object (DAO) and Repository patterns?

前端 未结 5 646
天涯浪人
天涯浪人 2020-12-02 03:24

I\'m trying to brush up on my design pattern skills, and I\'m curious what are the differences between these patterns? All of them seem like they are the same thing - encap

5条回答
  •  醉梦人生
    2020-12-02 03:59

    Data Mapper vs Table Data Gateway To make a long story short:

  • the Data Mapper will receive the Domain Model object(Entity) as param and will use it to implement the CRUD operations
  • the Table Data Gateway will receives all the params(as primitives) for the methods and will not know anything about the Domain Model object(Entity).

    In the end both of them will act as mediator between the in-memory objects and the database.

提交回复
热议问题