Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP.NET MVC Model
Message
From
08/07/2013 02:48:53
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01577926
Message ID:
01577934
Views:
62
>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.

You should add multiple tables in the EF model and define the relationships between them. If, as the classic example, you have Customer, Order and OrderDetail tables then the EF Customer entity will then have a collection of Orders and each Order will have a collection of OrderDetails.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform