- 优化 string IsNullable = false 时插入 null 自动转为 "" #445;

This commit is contained in:
28810
2020-09-02 19:20:41 +08:00
parent d025603997
commit 8eadde930f
4 changed files with 17 additions and 0 deletions

View File

@ -92,6 +92,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}

View File

@ -171,6 +171,8 @@ namespace FreeSql.Internal.CommonProvider
col.SetValue(data, val = FreeUtil.NewMongodbId());
}
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}

View File

@ -359,6 +359,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}
}
@ -379,6 +381,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}