Simple Convention Automapper for two-way Mapping (Entities to/from ViewModels)

后端 未结 4 500
[愿得一人]
[愿得一人] 2021-02-01 11:46

UPDATE: this stuff has evolved into a nice project, see it at http://valueinjecter.codeplex.com


check this out, I just wrote a simple automapper, it takes
4条回答
  •  感动是毒
    2021-02-01 11:56

    Just use AutoMapper. This is fine, but it'll grow into a mini project.

    Just some things AM (the real one) does is:

    • reporting if you have properties that can't be mapped to
    • flattening objects
    • providing hooks for you to customise some aspects, not in a big switch statement
    • using Expression.Compile for perf reasons rather than reflection directly

    But it's certainly an interesting space to mess about in, and the idea of auto mapping is certainly useful.

    A bit like DI in 15 or 33 lines vs NInject or its friends - cool, but why?.

    I take it you've read the article and comments regarding 2 way mapping on Jimmy's blog ?

提交回复
热议问题