DTO to Entity Mapping Tool

前端 未结 2 1378
清歌不尽
清歌不尽 2021-02-08 23:45

I have an entity class Person and its corresponding DTO class PersonDto.

public class Person: Entity
{
  public virtual string Name { g         


        
相关标签:
2条回答
  • 2021-02-09 00:06

    You can have a look on the two most used Object-Object mapper:

    AutoMapper

    AutoMapper is a simple little library built to solve a deceptively complex problem - getting rid of code that mapped one object to another. This type of code is rather dreary and boring to write, so why not invent a tool to do it for us?

    Value Injecter

    ValueInjecter lets you define your own convention-based matching algorithms (ValueInjections) in order to match up (inject) source values to destination values.

    There is a comparison article on SO: AutoMapper vs ValueInjecter

    0 讨论(0)
  • 2021-02-09 00:14

    You can use GeDA for mapping any entity to a DTO object, it comes with either annotations or DSL support.

    http://inspire-software.com/confluence/display/GeDA/FAQ

    There are only basic examples on the wiki but jUnits of source code are full of useful examples

    You can get it from sourceforge or google code manually or via maven dependency

    Details are here: http://inspire-software.com/confluence/display/GeDA/GeDA+-+Generic+DTO+Assembler

    0 讨论(0)
提交回复
热议问题