为所有数据库表增加TableBase基类,所有表增加Id和CreateDateTime字段

This commit is contained in:
Falcon 2024-07-26 11:05:19 +08:00
parent 68062259d0
commit 094447258f
4 changed files with 23 additions and 3 deletions

View File

@ -3,7 +3,7 @@
/// <summary>
/// 附件文件单元
/// </summary>
public class PlusFileUnit
public class PlusFileUnit:TableBase
{
/// <summary>
/// 文件指纹ID

View File

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace CalendarNotepad.Models
{
/// <summary>
/// 数据表基类
/// </summary>
public abstract class TableBase
{
/// <summary>
/// 数据主键
/// </summary>
[Key]
public string Id { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// 记录创建或最后修改时间
/// </summary>
public DateTime CreateDateTime { get; set; } = DateTime.Now;
}
}

View File

@ -7,7 +7,7 @@ namespace CalendarNotepad.Models
/// 工作记录单元
/// </summary>
[Table("WorkUnit")]
public class WorkUnit
public class WorkUnit:TableBase
{
/// <summary>
/// 工作日期

View File

@ -3,7 +3,7 @@
/// <summary>
/// 工作单元附件对应关系
/// </summary>
public class WorkUnitPlusFile
public class WorkUnitPlusFile:TableBase
{
/// <summary>
/// 工作日期