I've been reading up on AutoMapper because of a response to one of my earlier questions here.
It says that AutoMapper flattens complex domain models, but I need something that does the opposite. I need to wire up my view models (flattened domain models) to the complex domain models so that I can quickly transform a view model into a domain model.
Is there anything similar to AutoMapper that takes a view model and makes it into a complex domain model?
You do!. You create a MapToModel method where you do the right-hand/left-hand coding and sync the two together.
public MyModel MapToModel(MyViewModelForm vmf)
{
//new up MyModel model;
model.foo = vmf.foo;
return model;
}
If applications coded themselves, what exactly would we do for a living...?
Not really, because it would have to be extremely conventional to be useful. It's easy to discern patterns when flattening, but the other way 'round... just too much custom logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With