Creating the Domain Model

As I mentioned earlier, there are two kinds of model in an MVC framework: domain models and view models. It is common practice to create a separate class library project for the domain model and add it as a reference to the MVC framework project. The idea is that this helps enforce the separation between the domain model and the rest of the application. I usually take this approach on real projects, but to keep these examples simple, I am going to use the alternate approach of defining the model within the MVC framework project.

images Tip Putting the domain model into a separate project can be a little frustrating if you are ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.