Database 为定价系统创建数据库的更好方法
我需要创建一个价格表系统,所以我要在我的数据库中创建这三个表Database 为定价系统创建数据库的更好方法,database,asp.net-mvc-3,database-design,Database,Asp.net Mvc 3,Database Design,我需要创建一个价格表系统,所以我要在我的数据库中创建这三个表 PricingTable(ID、名称、服务ID、样式) PricingTable软件包(ID、PricingTable\u ID、标题、价格、PricePerTime、信息、标志、链接) PricingTablePackagesFeatures(ID,PricingTablePackages\u ID,Feature,Value,MoreInfo) 在这里,一个PriceTable可以容纳多个PricingTablePackage
- PricingTable
(ID、名称、服务ID、样式)
- PricingTable软件包
(ID、PricingTable\u ID、标题、价格、PricePerTime、信息、标志、链接)
- PricingTablePackagesFeatures
(ID,PricingTablePackages\u ID,Feature,Value,MoreInfo)
PriceTable
可以容纳多个PricingTablePackages
,一个PricingTablePackagesFeature
可以容纳多个PricingTablePackagesFeature
有没有办法设计出更好的模型?在单个数据库表中
我将为这些表创建一个MVC3模型,那么在MVC3模型中创建此类DB表的最佳方法是什么?当您需要使用Entity Framework时,我将使用公共虚拟变量作为“延迟加载”值: (变量类型可能会关闭,具体取决于您对每个变量的要求)
当您需要使用实体框架时,我会使用公共虚拟变量来“延迟加载”值: (变量类型可能会关闭,具体取决于您对每个变量的要求)
嗯,到目前为止我看不出有什么问题。。如果你想对这些表做什么都在那里描述了..应该没问题。我做了那张表,但我想如果还有什么好主意:)好的,我将应用它,谢谢你的评论:我没有看到任何问题到目前为止。。如果你想对这些表格做什么都在那里描述了,那应该没问题。我做了那个表格,但我想如果还有什么好主意的话:)好的,我将应用它,谢谢你的评论:D
public class PricingTablePackages
{
public int ID { get; set; }
public int PricingTableID { get; set; }
public virtual PricingTable PricingTable { get; set; }
public string Title { get; set; }
public decimal Price { get; set; }
public decimal PricePerTime { get; set; }
public string Info { get; set; }
public bool Flag { get; set; }
public string Link { get; set; }
}
public class PricingTablePackagesFeatures
{
public int ID { get; set; }
public int PricingTableID { get; set; }
public virtual PricingTable PricingTable { get; set; }
public string Feature { get; set; }
public string Value { get; set; }
public string MoreInfo { get; set; }
}
public class PricingTable
{
public int ID { get; set; }
public string Name { get; set; }
public int ServiceID { get; set; }
public virtual Service Service { get; set; } // if there is a Service class
public string Style { get; set; }
}