diff --git a/CalendarNotepad/Models/PlusFileUnit.cs b/CalendarNotepad/Models/PlusFileUnit.cs index f679896..6d4ca50 100644 --- a/CalendarNotepad/Models/PlusFileUnit.cs +++ b/CalendarNotepad/Models/PlusFileUnit.cs @@ -3,7 +3,7 @@ /// /// 附件文件单元 /// - public class PlusFileUnit + public class PlusFileUnit:TableBase { /// /// 文件指纹ID diff --git a/CalendarNotepad/Models/TableBase.cs b/CalendarNotepad/Models/TableBase.cs new file mode 100644 index 0000000..639fbe9 --- /dev/null +++ b/CalendarNotepad/Models/TableBase.cs @@ -0,0 +1,20 @@ +using System.ComponentModel.DataAnnotations; + +namespace CalendarNotepad.Models +{ + /// + /// 数据表基类 + /// + public abstract class TableBase + { + /// + /// 数据主键 + /// + [Key] + public string Id { get; set; } = Guid.NewGuid().ToString(); + /// + /// 记录创建或最后修改时间 + /// + public DateTime CreateDateTime { get; set; } = DateTime.Now; + } +} diff --git a/CalendarNotepad/Models/WorkUnit.cs b/CalendarNotepad/Models/WorkUnit.cs index b785e95..1d59767 100644 --- a/CalendarNotepad/Models/WorkUnit.cs +++ b/CalendarNotepad/Models/WorkUnit.cs @@ -7,7 +7,7 @@ namespace CalendarNotepad.Models /// 工作记录单元 /// [Table("WorkUnit")] - public class WorkUnit + public class WorkUnit:TableBase { /// /// 工作日期 diff --git a/CalendarNotepad/Models/WorkUnitPlusFile.cs b/CalendarNotepad/Models/WorkUnitPlusFile.cs index fb5d893..d415cbc 100644 --- a/CalendarNotepad/Models/WorkUnitPlusFile.cs +++ b/CalendarNotepad/Models/WorkUnitPlusFile.cs @@ -3,7 +3,7 @@ /// /// 工作单元附件对应关系 /// - public class WorkUnitPlusFile + public class WorkUnitPlusFile:TableBase { /// /// 工作日期