Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 03, 2012 02:55 PM by CodeHobo
Apr 03, 2012 02:32 PM|LINK
I am trying to make my code more efficient and easier to manage, I have nested models in my crud views, some can be 4 tiers deep.
The base models also have fields which will need adding serverside, like employeeID's, date and time last modified and new concurrency variable.
now I was going to use automapper, but there seems to be very little information about using it to map nested models from forms to entity models to allow to update, there is also no information how add and removed is used for automapper (to add and removed
and I don't want to waste my time if its not going to work, does someone have any guidelines or docs on the best plan of action so I can put it in place automapper or otherwise
Apr 03, 2012 02:55 PM|LINK
For the auto mapper questions, you might get better replies at the automapper github issues page
Are you using a view model specific to each view? Automapper does allow you to flatten a model from a complex nested model to simple view model. That should cover sending the data to the view
The other way around, you , take a look at nested mappings
However, you might want to apply a specialized factory object that's sole reponsbility is taking the view model and constructing your complex model based on what was returned to the mvc action. That way you are isolating the construction of the complex model
to one place.