本文启发的思路来源于asp.net mvc 6 的entity framework,微软MSDN中的官方项目contoso university 虚构的数据库
原文链接如下;
https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application
针对项目中的实际需求,考虑使用的数据结构包括:生产线员工,生产线设备,产品型号,工艺数据等信息。
public class UserInfo { public string UserID { get; set; } public string UserName { get; set; } public int UserAge { get; set; } public string UserSkill { get; set; } public string UserJob { get; set; } public string UserRole { get; set; } public string UserStatus { get; set; } public string UserFingerPrint { get; set; } public string UserTeamNum { get; set; } public DateTime UserTime { get; set; } public string UserPassword { get; set; } public virtual ICollection<DeviceInfo> DeviceInfoes { get; set; } public virtual ICollection<ProductInfo> ProductInfoes { get; set; } }
//Device public class DeviceInfo { public int DeviceID { get; set; } public string DeviceName { get; set; } public DateTime? DeviceTimeBought { get; set; } public DateTime? DeviceTimeUseAll { get; set; } public DateTime? DeviceTimeUserAfterMaintain { get; set; } public DateTime? DeviceTimeUseThisTime { get; set; } public DateTime? DeviceMaintainTime { get; set; } public string DevieceUser { get; set; } public string DeviceBelonging { get; set; } public string DeviceRunCycyle { get; set; } public string DevicepartNum { get; set; } public int? ProductID { get; set; } public string UserID { get; set; } public virtual UserInfo UserInfo { get; set; } public virtual ProductInfo ProductInfo { get; set; } }
public class ProductInfo { public int ProductID { get; set; } public string DeviceID { get; set; } public string UserID { get; set; } public int ProductpipeLineNum { get; set; } public int ProductOrderNum { get; set; } public string ProductMark { get; set; } public float? ProductParameter { get; set; } public float? ProductDifference { get; set; } public float? ProductRunOut { get; set; } public string ProductRivetPart { get; set; } public string ProductRivet2Part { get; set; } public string ProductRubPart { get; set; } public string ProductHubPart { get; set; } public string ProductSuckPart { get; set; } public string ProductPadPart { get; set; } public string ProductTeamNum { get; set; } public string ProductStatus { get; set; } public DateTime? ProductStartTime { get; set; } public DateTime? ProductFinishedTime { get; set; } public bool ProductResult { get; set; } public virtual UserInfo UserInfo { get; set; } public virtual DeviceInfo DeviceInfo { get; set; } }
//ParameterData public class ParameterDate { public DateTime? PDPickTime { get; set; } public string PDRunout { get; set; } public string PDDifference { get; set; } public string PDPressure { get; set; } public string PDStatus { get; set; } public string PDCountID { get; set; } public string ProductID { get; set; } public string DeviceID { get; set; } public string UserID { get; set; } public virtual UserInfo UserInfo { get; set; } public virtual ProductInfo ProductInfo { get; set; } public virtual DeviceInfo DeviceInfo { get; set; } }
通过设计数据库将数据关联起来,实现crud操作,下一节内容继续按照文章的思路继续。
原文地址:https://www.cnblogs.com/ThreeS/p/9535530.html
时间: 2024-10-12 02:23:11