ASP.NET MVC ActionFilter with AutoMapper and View Model Sample Code

Tampa ASP.NET MVC Developer GroupAnother stellar turnout at the July Meeting of the Tampa ASP.NET MVC Developer Group, entitled ASP.NET MVC Extensibility. The room was packed despite the torrential rains that try to keep us from our meetings ;)

During the meeting, I did a quick 20 minute presentation on custom ActionFilters. Wanting to show something a bit fresh, I decided to show off Jimmy Bogard's example of using a custom ActionFilter with AutoMapper to map a domain model entity to a view model class. I took his code along with some additional pieces and added it to the code I had written for Homework Assignment #2.

Although the example is too trivial for real world use of a View Model and AutoMapper, I wanted to show off a custom ActionFilter that might be of use to you in more complex applications where you need a separate View Model from the Domain Model.

Hope you enjoy the code.

David Hayden

 

Related Posts:

 

posted on Friday, July 10, 2009 2:15 PM

Main

David Hayden Google +

David Hayden Twitter

Health & Fitness

JavaScript Patterns Book Review

HTML 5 and CSS3 - Develop with Tomorrow's Standards Today

Professional ASP.NET Design Patterns Book Review

Beginning Mac Programming Book Review

C# in Depth Book Review

ASP.NET MVC

Orchard CMS

Categories