diff --git a/Configurations/SimApiOptions.cs b/Configurations/SimApiOptions.cs index 51a69fc..678fc66 100644 --- a/Configurations/SimApiOptions.cs +++ b/Configurations/SimApiOptions.cs @@ -61,14 +61,14 @@ namespace SimApi.Configs /// /// Swagger文档相关配置,需要启用 EnableSimApiDoc /// - public SimApiDocOptions SimApiDocOptions { get; set; } = new SimApiDocOptions(); + public SimApiDocOptions SimApiDocOptions { get; set; } = new(); /// /// S3兼容的存储系统配置,需要启用 EnableSimApiStorage /// - public SimApiStorageOptions SimApiStorageOptions { get; set; } = new SimApiStorageOptions(); + public SimApiStorageOptions SimApiStorageOptions { get; set; } = new(); - public SimApiSynapseOptions SimApiSynapseOptions { get; set; } = new SimApiSynapseOptions(); + public SimApiSynapseOptions SimApiSynapseOptions { get; set; } = new(); public void ConfigureSimApiSynapse(Action options = null) { diff --git a/Models/SimApiBaseModel.cs b/Models/SimApiBaseModel.cs index 2cbcfbc..790491e 100644 --- a/Models/SimApiBaseModel.cs +++ b/Models/SimApiBaseModel.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text.Json; using SimApi.Helpers; @@ -7,10 +8,16 @@ namespace SimApi.Models { public class SimApiBaseModel { - protected virtual string[] MapperIgnoreField { get; set; } = - { - "Id", "CreatedAt", "UpdatedAt" - }; + [Column(Order = 1)] + public string Id { get; set; } = Guid.NewGuid().ToString(); + + [Column(Order = 9998)] + public DateTime UpdatedAt { get; set; } = SimApiUtil.CstNow; + + [Column(Order = 9999)] + public DateTime CreatedAt { get; set; } = SimApiUtil.CstNow; + + protected virtual string[] MapperIgnoreField { get; set; } = { "Id", "CreatedAt", "UpdatedAt" }; protected virtual string UpdatedTimeField { get; set; } = "UpdatedAt"; diff --git a/SimApi.csproj b/SimApi.csproj index 2273f62..1c593b9 100644 --- a/SimApi.csproj +++ b/SimApi.csproj @@ -14,7 +14,7 @@ false true 5.0.2 - net7.0 + net7.0;net8.0