ASP.NET MVC ModelCopier
In my earlier post ViewModel patten and AutoMapper in ASP.NET MVC application, We have discussed the need for View Model objects and how to map values between View Model objects and Domain model objects using AutoMapper. ASP.NET MVC futures assembly provides a static class ModelCopier that can also use for copying values between View Model objects and Domain model objects. ModelCopier class has two static methods - CopyCollection and CopyModel.CopyCollection method would copy values between two collection objects and CopyModel would copy values between two model objects.
var expense=new Expense();
ModelCopier.CopyModel(expenseViewModel, expense);
The above code copying values from expenseViewModel object to expense object.
For simple mapping between model objects, you can use ModelCopier but for complex scenarios, I highly recommending to using AutoMapper for mapping between model objects.