为所有数据库表增加TableBase基类,所有表增加Id和CreateDateTime字段
This commit is contained in:
parent
68062259d0
commit
094447258f
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// 附件文件单元
|
||||
/// </summary>
|
||||
public class PlusFileUnit
|
||||
public class PlusFileUnit:TableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件指纹ID
|
||||
|
|
20
CalendarNotepad/Models/TableBase.cs
Normal file
20
CalendarNotepad/Models/TableBase.cs
Normal 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;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ namespace CalendarNotepad.Models
|
|||
/// 工作记录单元
|
||||
/// </summary>
|
||||
[Table("WorkUnit")]
|
||||
public class WorkUnit
|
||||
public class WorkUnit:TableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 工作日期
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/// <summary>
|
||||
/// 工作单元附件对应关系
|
||||
/// </summary>
|
||||
public class WorkUnitPlusFile
|
||||
public class WorkUnitPlusFile:TableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 工作日期
|
||||
|
|
Loading…
Reference in New Issue
Block a user