Skip to content

Commit

Permalink
- 修复 FreeSql.Generator 默认值 NULL 处理问题;dotnetcore#645
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Jan 14, 2021
1 parent 02785f4 commit 013eec2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Extensions/FreeSql.Generator/RazorModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public string GetColumnDefaultValue(DbColumnInfo col, bool isInsertValueSql)
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")
Expand Down

0 comments on commit 013eec2

Please sign in to comment.