DTO pattern: Best way to copy properties between two objects

后端 未结 6 1317
死守一世寂寞
死守一世寂寞 2020-12-12 12:33

In my application\'s architecture I usually send the object or list of objects from the data access layer to the web layer via the service layer, in which these objects get

6条回答
  •  醉话见心
    2020-12-12 13:17

    You can use reflection to find all the get methods in your DAO objects and call the equivalent set method in the DTO. This will only work if all such methods exist. It should be easy to find example code for this.

提交回复
热议问题