|
Thread: Mvc
-
Mar 28th, 2010, 07:13 AM
#21
Re: Mvc
 Originally Posted by Grhymn
So the view model is part of the controller?
No, it's part of the model, but a model specifically created for a view. For instance, I'm using the Entity Framework in a current project. The EF model closely follows the database schema and that's fine in the majority of cases. In one or two cases though, the structure of the data displayed by a view doesn't look like a single record or a single table from the database. In those cases, my service layer retrieves data from the EF model and massages it into a view model, which then gets passed back to the controller, which passes it on to the view. The view model class is declared in the Models folder of your MVC project, even if your actual model exists in a separate project altogether, as mine does.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|