Simple merging object to object

I use View Models to hand to my MVC views, nice and slim with little if any methods on them and I use a think ORM model that has all my business logic and is generated by my ORM (BLToolkit).

So the problem is I wanted to take the View Model and update the ORM model with the modified values from the post, kind of a reverse AutoMapper (or BLToolkit.Mapper).

So a ORM class like this;

And a View Model like this (note the type and name should be “EXACTLY” the same;

Then with this generic Extension method;

So you make the magic in the Controller (for example) like this;

Yea its cheesy, but it works for me 😉