- FreeSql.Generator DefaultValue

This commit is contained in:
2881099 2020-11-23 22:33:37 +08:00
parent 4b875eaf7c
commit 3014e6faf0

View File

@ -218,6 +218,8 @@ public class RazorModel {
else if (defval.StartsWith("(") && defval.EndsWith(")")) defval = defval.Substring(1, defval.Length - 2);
else return null;
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 ((cstype == typeof(string) && defval.StartsWith("'") && defval.EndsWith("'::character varying") ||
cstype == typeof(Guid) && defval.StartsWith("'") && defval.EndsWith("'::uuid")