diff --git a/OpenAuth.Repository/Domain/Module.cs b/OpenAuth.Repository/Domain/Module.cs index a5332b03..2ab0b9b3 100644 --- a/OpenAuth.Repository/Domain/Module.cs +++ b/OpenAuth.Repository/Domain/Module.cs @@ -94,7 +94,7 @@ namespace OpenAuth.Repository.Domain /// 前端界面是否缓存 /// /// [Description("前端界面是否缓存")] - public bool? KeepAlive { get; set; } + public bool KeepAlive { get; set; } } } \ No newline at end of file diff --git a/OpenAuth.Repository/OpenAuthDBContext.cs b/OpenAuth.Repository/OpenAuthDBContext.cs index bbe57044..d73864dd 100644 --- a/OpenAuth.Repository/OpenAuthDBContext.cs +++ b/OpenAuth.Repository/OpenAuthDBContext.cs @@ -95,6 +95,14 @@ namespace OpenAuth.Repository { property.SetValueConverter(boolToSmallIntConverter); } + + //解决PostgreSQL时间戳问题 + if (Database.ProviderName == "Npgsql.EntityFrameworkCore.PostgreSQL" && + property.ClrType == typeof(DateTime)) + { + property.SetValueConverter(new ValueConverter( + v => v.ToUniversalTime(), v => DateTime.SpecifyKind(v, DateTimeKind.Utc))); + } } } }