From 7dc8ded2a8d7f0ce3146391567a16705099dbeb5 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 10 Feb 2023 18:16:59 +0800 Subject: [PATCH] Update CodeFirst (DateOnly TimeOnly) --- .../Abstract/EntityMaintenance/EntityMaintenance.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs index 411920a89..8a41be8fe 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/EntityMaintenance/EntityMaintenance.cs @@ -346,6 +346,14 @@ namespace SqlSugar { continue; } + if (column.DataType == null&& property != null&& property.PropertyType.Name.IsIn("TimeOnly")) + { + column.DataType = "time"; + } + if (column.DataType == null && property != null && property.PropertyType.Name.IsIn("DateOnly")) + { + column.DataType = "date"; + } result.Columns.Add(column); } }