我有 7 节课:
public class Entity
{
public int Id { get; set; }
}
public class Product : ????
{
// Contructor
public Product()
{
Photos = new HashSet<PhotoSource>();
ProductFeatures = new HashSet<ProductFeature>();
}
// Primitives
public string ProductName { get; set; }
public string InternalSKU { get; set; }
public string ModelNumber { get; set; }
public string Description { get; set; }
public int QtyPerUnit { get; set; }
public double UnitPrice { get; set; }
public int UnitsInStock { get; set; }
public int UnitsOnOrder { get; set; }
public int? ReOrderLevel { get; set; }
public string Warranty { get; set; }
// Foreign Keys
public int SubCategoryID { get; set; }
public int VendorId { get; set; }
// Navigation Properties
// Classes
[ForeignKey("SubCategoryID")]
public virtual SubCategory SubCategory { get; set; }
[ForeignKey("VendorId")]
public virtual Vendor Vendor { get; set; }
// Collections
public virtual ICollection<PhotoSource> Photos { get; set; }
public virtual ICollection<ProductFeature> ProductFeatures { get; set; }
}
public class ProductSeasonal : ????
{
// Primitives
public int? OffSeasonDiscount { get; set; }
public DateTime SeasonStartDate { get; set; }
public DateTime SeasonEndDate { get; set; }
public int? QtyLimitedTo { get; set; }
}
public class ProductDiscontinued : ????
{
// Primitives
public DateTime DiscontinuedDate { get; set; }
public int DiscontinuedDisount { get; set; }
}
public class Supply : ????
{
// Primitives
public String UnitMeasurement { get; set; }
}
public class Part : ????
{
// Primitives
public String UnitMeasurement { get; set; }
}
public class Vehicle : ????
{
// Constructor
public Vehicle()
{
ExteriorFeatures = new HashSet<ProductFeature>();
InteriorFeatures = new HashSet<ProductFeature>();
SafetyFeatures = new HashSet<ProductFeature>();
}
// Primitives
public string VIN { get; set; }
public int Year { get; set; }
public int CylinderSize { get; set; }
public double EngineSize { get; set; }
public string StyleType { get; set; } //Truck, SUV, Sedan, Convertible, etc
public string TransmissionType { get; set; }
public string InteriorColor { get; set; }
public string ExteriorColor { get; set; }
// Foreign Keys
public virtual int MakeId { get; set; }
// Navigation Properties
// Classes
[ForeignKey("MakeId")]
public virtual VehicleMake Make { get; set; }
// Collections
public virtual ICollection<ProductFeature> InteriorFeatures { get; set; }
public virtual ICollection<ProductFeature> ExteriorFeatures { get; set; }
public virtual ICollection<ProductFeature> SafetyFeatures { get; set; }
}
什么是设置继承的最佳方式,以便车辆、零件、用品和任何未来的销售项目类 [例如。服装] 可以毫不费力地添加多余的属性吗?