DTO to Entity Mapping Tool

前端 未结 2 1377
清歌不尽
清歌不尽 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

提交回复
热议问题