Any advantage to using the build-in mapper over AutoMapper?

Why not just incorporate AutoMapper? Or suggest that your users use it?


Updated at 16.07.2010 20:56:51

And is there an example of the built-in mapper? I can't seem to find how to use it.

Moreover, the one-to-one mapping limitation is a big problem, IMHO.

In ASP.NET MVC, for example, one might have a CustomerViewModel, CustomerEditModel, CustomerIndexModel, etc... and each of these have their own mappings.

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 16 '10 at 20:27

ara's gravatar image

ara
395858791


One Answer:

If it's about O2O (object-to-object) mapping, build-in mapper is capable of extracting the changes made to graph produced by it. AutoMapper can't do this - they ignored this part at all.

Concerning examples: tests for it seems the only helpful thing here, see http://goo.gl/Pj4a


I can add I thought about refactoring its mapping API - I dislike it, because it uses .MapType (single method) instead of .Map(...).To(...) (method chain), that makes mapping configuration completely unreadable. There is an issue for this: http://code.google.com/p/dataobjectsdot ... ail?id=623 - discussion there is in Russian (just copy-paste from Skype), may be Google Translate will help, if you need more details about this refactoring.

IMHO, this is the main disadvantage it has - unreadable fluent configuration API.


> Moreover, the one-to-one mapping limitation is a big problem, IMHO.

O2O mapper doesn't have this limitation: you can build custom mappings for any particular case. All you need is to build a particular mapping configuration invoking .MapType for DTOs you'd like to map.

Btw, it worth to mention it relies on convention over configuration while mapping fields:

  • It automatically maps the fields with the same name

  • As far as I remember, it even recognizes ProductOrder - like chains. I'll ask they developer responsible for this to add more comments here.

answered Jul 17 '10 at 15:27

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

As far as I remember, it even recognizes ProductOrder - like chains. Sorry, that's wrong - this feature is not implemented. But you can describe such chains manually.

(Jul 17 '10 at 15:27) Alex Yakunin Alex%20Yakunin's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: Jul 16 '10 at 20:27

Seen: 3,435 times

Last updated: Jul 16 '10 at 20:27

powered by OSQA