From 013eec2264ec674a9c055082efad07bf13bee02d Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Thu, 14 Jan 2021 17:54:56 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20FreeSql.Generator=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=20NULL=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B#645?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Extensions/FreeSql.Generator/RazorModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Extensions/FreeSql.Generator/RazorModel.cs b/Extensions/FreeSql.Generator/RazorModel.cs index 95d51cdc..9f3fbdc3 100644 --- a/Extensions/FreeSql.Generator/RazorModel.cs +++ b/Extensions/FreeSql.Generator/RazorModel.cs @@ -220,6 +220,7 @@ public class RazorModel { if (defval.StartsWith("N'") && defval.EndsWith("'")) defval = defval.Substring(1); if (cstype == typeof(Guid) && string.Compare(defval, "newid()", true) == 0) return $"Guid.NewGuid()"; if (cstype == typeof(string) && string.Compare(defval, "newid()", true) == 0) return $"Guid.NewGuid().ToString().ToUpper()"; + if (defval == "NULL") return null; } if ((cstype == typeof(string) && defval.StartsWith("'") && defval.EndsWith("'::character varying") || cstype == typeof(Guid) && defval.StartsWith("'") && defval.EndsWith("'::uuid")