【发布时间】:2014-01-17 10:27:08
【问题描述】:
我对创建数据字典的正确方法有疑问。 我以前从未这样做过,但现在我必须这样做。
此时我要数据表:
public class Device
{
public int DeviceId { get;set; }
public string DeviceSerialNumber { get; set; }
[Required]
[StringLength(14)]
public string DeviceUser { get; set; }
public int DeviceDictionaryId { get; set; }
[ForeignKey("DeviceDictionaryId")]
public virtual DeviceDictionary DeviceDictionary {get;set;}
public string Batch { get; set; }
}
我的字典用于创作目的:
public class DeviceDictionary
{
public int DeviceDictionaryId { get; set; }
[Required]
public string DeviceManufacturer { get; set; }
[Required]
public string DeviceName { get; set; }
}
现在是我的问题。
我做的设计是好的还是我应该做一些改变?我考虑将 DeviceDictionary 拆分为 2 个新表:Manufactures 和 DeviceName 与外键 ManufacturerId 连接。
谁能建议我哪种方式更适合我的简单解决方案?
【问题讨论】:
-
也许你应该添加标签你正在使用什么数据库,这样你就可以吸引更多来自该社区的人
-
@vasin1987,这个问题几乎与数据库引擎无关。
标签: c# sql-server database-design