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

后端 未结 4 434
[愿得一人]
[愿得一人] 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:57

    you can add exceptions (ifs, switch) for each type you may need

    You're not going to do this. Seriously. Case statements acting on object types are bad OOP style. I mean, really bad. Like driving with a drink of Vodka inside your stomach. It may work for some time, but eventually you get into trouble.

    OK Jimmy told you not to use AutoMapper... but I bet he meant something else. Now, have you invented something different - something that make Jimmy happy? ;-) No, you just made your own half-rolled AutoMapper. And Jimmy told you not to use it! ;-)

    So here's my suggestion: ignore what Jimmy says, just think yourself.. and use AutoMapper ;-)

提交回复
热议问题