tags:

views:

48

answers:

1

Can Automapper map values from a NameValueCollection onto an object, where target.Foo receives the value stored in the collection under the "Foo" key?

I have a business object that stores some data in named properties and other data in a property bag. Different views make different assumptions about the data in the property bag, which I capture in page-specific view models. I want to use AutoMapper to map both the "inherent" attributes (the ones that always exist) as well as the "dynamic" attributes (the ones that vary per view and may or may not exist).

A: 

Not out of the box right now, it's something I'm looking at for 2.0. You can however build a custom IObjectMapper to do this for you.

Jimmy Bogard
Thanks for the reply. It looks like I might be able to use `.AfterMap()` as well, correct?
Seth Petry-Johnson
Yes, that's something we use quite a bit for that post-map processing.
Jimmy Bogard

related questions