標籤:官方 asp work tin eating cti creating with 設計
本文啟發的思路來源於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操作,下一節內容繼續按照文章的思路繼續。
asp.net mvc entity framework 資料庫 練習(一)