- 修复 SqlServer 批量更新 bool? null 值生成多余的 case when SQL;

This commit is contained in:
2881099
2023-12-13 20:42:20 +08:00
parent 09c872562e
commit 2368377b0d
2 changed files with 101 additions and 113 deletions

View File

@ -858,6 +858,7 @@ namespace FreeSql.Internal.CommonProvider
new[] { typeof(string), typeof(DateTime), typeof(DateTime?) }.Contains(col.Attribute.MapType) ||
col.Attribute.MapType.NullableTypeOrThis().IsEnum;
var ds = _source.Select(a => col.GetDbValue(a)).ToArray();
if (valsameIf == false && ds[0] == null) valsameIf = true;
if (valsameIf && ds.All(a => object.Equals(a, ds[0])))
{
var val = ds.First();
@ -1119,7 +1120,8 @@ namespace FreeSql.Internal.CommonProvider
new[] { typeof(string), typeof(DateTime), typeof(DateTime?) }.Contains(col.Attribute.MapType) ||
col.Attribute.MapType.NullableTypeOrThis().IsEnum;
var ds = _source.Select(a => col.GetDbValue(a)).ToArray();
if (valsameIf && ds.All(a => object.Equals(a, ds[0])))
if (valsameIf == false && ds[0] == null) valsameIf = true;
if (valsameIf && ds.All(a => object.Equals(a, ds[0])))
{
var val = ds.First();
var colsql = _noneParameter ? _commonUtils.GetNoneParamaterSqlValue(_paramsSource, "u", col, col.Attribute.MapType, val) :