Database Reference
In-Depth Information
Figure 13-14. A model for a Customer, their CreditCards, and Transactions
To start, this example leverages the Code-First approach for Entity Framework. In Listing 13-23, we create the
Customer, CreditCard, and Transaction entity classes.
Listing 13-23. The Reservation Entity Object
public class Customer
{
public Customer()
{
CreditCards = new HashSet<CreditCard>();
}
public int CustomerId { get; set; }
public string Name { get; set; }
public string City { get; set; }
public virtual ICollection<CreditCard> CreditCards { get; set; }
}
public class CreditCard
{
public CreditCard()
{
Transactions = new HashSet<Transaction>();
}
public string CardNumber { get; set; }
public string Type { get; set; }
public System.DateTime ExpirationDate { get; set; }
public int CustomerId { get; set; }
public virtual Customer Customer { get; set; }
public virtual ICollection<Transaction> Transactions { get; set; }
}
 
Search WWH ::




Custom Search