Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ASP.NET MVC Model
Message
 
 
À
07/07/2013 14:31:07
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01577926
Message ID:
01577928
Vues:
53
Thank you. I have not yet learned the "ViewModel"; in the courses they only talked about "Model". I will read your blog.

>A Model should "model" what the database looks like. What you need is a ViewModel.
>
>Keeping it simple, the controller will call multiple models to populate the ViewModel. A ViewModel is a model used just for a view. It doesn't actually talk to the database, just handles data for the View. I have a blog series on unit testing MVC and one post talks about setting up the SelectList. It may be of help to you.
>See http://www.craigberntson.com/blog/?p=1123
>
>Eventually, you'll want to pull this kind of stuff out of the Controller as it should be a very thin layer. But for now, don't overcomplicate your learning.
>
>
>>I am learning how to create Model using EF (learning from various Pluralsight courses). So far what I understood is that the controller creates a model from EF and passes it to the View. And the examples I watched - so far - deal with only one table. But what if I need to use more that one table in the View? For example, a "main" table for the fields of the View and several tables used as look-ups? Does it mean that the controller then creates several models and passes to the View not one but several Models?
>>
>>TIA.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform