Database Reference
In-Depth Information
Figure 8-2. The model for our customers' orders
5.
We will be using generated classes for our entities. By default, Entity Framework 6
generates entity classes in the form of POCO. Thus all of the database access code is in a
separate class, and entities are generated in separate plain classes. It will yield the same
implementation result as would have been created manually in previous Entity Framework
versions by turning off code generation for the model. In this version, Code Generation
Strategy is already set to None. The code in Listing 8-1 shows the classes for our model.
Listing 8-1. The Plain Old CLR classes for Our Model
public partial class Customer
{
public Customer()
{
this.Orders = new HashSet<Order>();
}
public int CustomerId { get; set; }
public string ContactName { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}
 
Search WWH ::




Custom Search