Can Automapper populate a strongly typed object from the data in a NameValueCollection?

Posted by Seth Petry-Johnson on Stack Overflow See other posts from Stack Overflow or by Seth Petry-Johnson
Published on 2010-03-22T14:27:23Z Indexed on 2010/03/22 14:31 UTC
Read the original article Hit count: 380

Filed under:

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).

© Stack Overflow or respective owner

Related posts about automapper