Sunday, June 3, 2012

Pagination with AutoMapper

I recently posted a method of using AutoMapper in an ActionResult (http://bzbetty.blogspot.co.nz/2012/06/thoughts-on-actionfilters.html).  This became an issue when I was trying to return a paginated model to the view, as I wanted to do pagination in the database (on the entities) but AutoMapper had no idea how to map the IPagination result to the ViewModel.

Result - Build a custom IObjectMapper to do the mapping


Resulting Action

IObjectMapper