Chapter 18. Mapping with AutoMapper

This chapter covers

  • Understanding AutoMapper
  • Configuring AutoMapper
  • Testing conventions
  • Applying formatters to eliminate duplicative code
  • Reducing markup to presentation only
  • Ridding views of complexity

The open source AutoMapper library is a convention-based object-to-object mapper. It takes source objects of one type and maps them to destination objects of another type. This is useful in many contexts, but we’ll use it to map from a domain model to the model objects our views display—the presentation model.

We call it convention based because it doesn’t depend on configuring each type’s member’s mapping, but instead relies on naming patterns and sensible defaults. You can check out the code and read ...

Get ASP.NET MVC 2 in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.