Mapping Between Entities and View Models
As many of you know, my recent course on Pluralsight dealt with Best Practices in ASP.NET: Entities, Validation and View Models. As I’ve worked with clients, there seem to be a non-ending list of ways to deal with data in ASP.NET.
One of the topics that I am passionate about as it relates to the course is how to manage the Model to Entity relationship. While being pragmatic is important, I still believe that there are many situations where you want a separate Model for a view (server or client-side) instead of just using the Entities that you’re storing data with.
The challenge here is how to do the mapping between the entities and models without having to churn out tons of boilerplate. Luckily, there are a number of solutions including AutoMapper.
As a preview, I present to you a taste of the course where I show how to use AutoMapper to create maps between Entities and Models for server-side views. I hope you enjoy it:
If you like the video, you can view the entire course as a Pluralsight subscriber here:
Hope you like it!