Last post Apr 03, 2012 07:18 PM by ryanw51
Apr 03, 2012 11:53 AM|EnenDaveyBoy|LINK
I am rebuilding some view models to make easier to maintain and I want to use inheritance, now I know how to get the view model to inheriate the necessary properties, however my question is how to populate them.
Lets say I have a Employee, Customer, and Guest viewModel, that all inheriate 5 things, if I have a controller for each model that allows me to update them, that would mean I have to create the model and populate it with the inheriated properties on each
controller, so I effectively have to create the same code in each controller to populate the same inheriated fields.
So whats the best way to go about populating the properties so I can maintain them better?
Apr 03, 2012 03:04 PM|BrockAllen|LINK
Automapper is a popular library for doing this.
Apr 03, 2012 07:03 PM|EnenDaveyBoy|LINK
Thanks, but the documention isn't very good IMO, there simply isn't enough of it.
Apr 03, 2012 07:18 PM|ryanw51|LINK
Did you actually look at the
documentation? I think they've thoroughly documented every single feature in AutoMapper. There is also a robust
AutoMapperSamples solution that gives a ton of code examples.