Failure is inevitable


A Better Way to Configure AutoMapper for ASP.NET MVC (Video)

AutoMapper is one of the essential tools in my ASP.NET MVC toolbelt.  I use it on every MVC project I do.  It's saved me countless lines of code over the years.  And yet, there's always been one thing that bugged me about it: it violates the idea of "common closure."  I've built a better way to handle this, but as my friends have accused reminded me, I might have forgotten to share this approach publicly.  Until now.

With AutoMapper, you typically place your mapping configuration in a completely separate profile class, which creates an artificial barrier between two things that are likely to change together: your view model and its mapping definition.  I came up with an alternative many years ago, but as my "friends" have pointed out, I apparently haven't blogged it or talked about it openly before my Pluralsight course.  To try and make up for that serious misstep on my part, I've extracted the relevant part of my Pluralsight course and made it available for free on YouTube.  You can check it out here: ASP.NET MVC - Better Conventions for AutoMapper.

Full disclosure: this is a small piece of my full course, and the full course does require a Pluralsight subscription, and I do indeed make money if you subscribe and watch my course. Winking smile

About Matt Honeycutt...

Matt Honeycutt is a software architect specializing in ASP.NET web applications, particularly ASP.NET MVC. He has over a decade of experience in building (and testing!) web applications. He’s an avid practitioner of Test-Driven Development, creating both the SpecsFor and SpecsFor.Mvc frameworks.

He's also an author for Pluralsight, where he publishes courses on everything from web applications to testing!

blog comments powered by Disqus