我想使用EF 4.1 Code First Model創建我的第一個應用程序。我想爲雜誌訂閱建模,但只想檢查我的POCO類是否適合用途。EF4.1 Code First Question
以下是我的課程。我錯過了什麼?
客戶應該是訂閱的成員還是應該只是該列表成爲客戶的成員?
謝謝。
public class Subscription
{
public int SubscriptionID { get; set; }
public string CardNumber { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public decimal NetPrice { get; set; }
public decimal Tax { get; set; }
public decimal Discount { get; set; }
public string PromotionalCode { get; set; }
public Customer Customer{ get; set; }
}
public class Customer {
public int CustomerID { get; set; }
public string Title { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public PostalAddress PostalAddress { get; set; }
public string EmailAddress { get; set; }
public string Telephone { get; set; }
public string Mobile { get; set; }
public DateTime DateOfBirth { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string SecurityQuestion { get; set; }
public string SecurityAnswer { get; set; }
public bool Valid { get; set; }
public IList<Subscription> Subscriptions { get; set; }
public bool MailMarketing { get; set; }
public bool PartnerMailMarketing { get; set; }
}
public class PostalAddress
{
public int ID { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string Address3 { get; set; }
public string City { get; set; }
public string Postcode { get; set; }
public string Region { get; set; }
public string Country { get; set; }
}
它只需要虛擬,如果你想懶加載(這可能是他想要的) – KallDrexx 2011-04-14 19:34:32
感謝您對此回覆。在我繼續之前,我只是想確保自己處於正確的位置。 – FloatLeft 2011-04-14 23:45:09
@KallDrexx很高興知道,謝謝。 – 2011-04-15 13:59:03