0
我很新,實體框架和基於數據的應用程序。我們是否需要客戶的屬性以及訂單模型類中的CustomerId屬性?
讓Customer
數據模型類如下:
public class Customer
{
public int CustomerId {get;set;}
public string Name {get;set;}
//others properties have been omitted for the sake of simplicity.
}
而且Order
數據模型:
public class Order
{
public int OrderId {get;set;}
public int CustomerId {get;set;}
public Customer Customer {get;set;}
// other properties have been omitted for the sake of simplicity.
}
我的問題是:「我們是否需要的Customer
屬性與屬性一起CustomerId
in Order
model class?「
考慮到性能,哪一個更好:具有在`Order`類`Customer`屬性或具有'Order`類`CustomerId`財產? – xport 2011-02-07 04:25:51