AutoMapper

Jul 15, 2011 at 9:57 PM

Hello,

i'm just curious why all mapping is done via ToSomeModel() static methods,

and not like in "Domain Oriented N-Layered .NET 4.0 App Sample" (http://microsoftnlayerapp.codeplex.com)

 where mapping is done with AutoMapper ?

 

Thank You !

Developer
Jul 19, 2011 at 7:06 PM

There are a number of libraries that can handle automatic mapping between types.  Automapper is a great option if you can use it.  Unfortunately, within the environment we work within at Microsoft, using outside open-source software can be a challenge that involves talking to the legal department on a project by project basis (I won't tell you how much fun that is. :-) ).

As a result, we intentionally did the simplest thing that would work using the static (or were the extension) methods. 

However, if you can offload that code to a well tested external library, I recommend you do so on your projects.

I hope that helps,
Michael Puleio