Database Reference
In-Depth Information
Alternately, you can manually create each of your entity classes in Visual Studio and simply register them in
the DbContext object, then hook into the Entity Framework services. Entity Framework will map the classes to the
underlying databases and automatically create a model in memory at runtime.
With the Model-First or Database-First approaches, you use the Entity Framework designer to develop your
model. The key parts of a model in the designer are shown in Figure 1-6 . In this model, a Customer has a one-to-many
association with an Order. Each customer may have many orders, but each order is associated with just one customer.
The Mapping Details window shows that the Customer EntityType maps to the Customer table in the database.
The Mapping Detail window also shows the mapping between the columns in the Customer table and the scalar
properties in the Customer EntityType. Keep in mind that you can make the same kind of mapping configurations
using the data annotations or fluent API features found in the Code First approach to using Entity Framework.
Figure 1-6. Key parts of a model in the designer
 
Search WWH ::




Custom Search