mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 修复 SqlServer 批量更新 bool? null 值生成多余的 case when SQL;
This commit is contained in:
@ -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) :
|
||||
|
Reference in New Issue
Block a user