- 修复 UseCommandParameterWithLambda IN 参数化判断 的逻辑 bug;#1137

This commit is contained in:
2881099
2022-06-01 15:27:35 +08:00
parent 105947c2ed
commit eabe1decb8
2 changed files with 117 additions and 0 deletions

View File

@ -2058,6 +2058,14 @@ namespace FreeSql.Internal
if (_common.CodeFirst.IsGenerateCommandParameterWithLambda && dbParams != null)
{
if (obj == null) return "NULL";
if (mapColumn != null)
{
var objType = obj.GetType();
if (obj is ICollection && objType.GetGenericArguments().FirstOrDefault()?.NullableTypeOrThis() == mapColumn.CsType?.NullableTypeOrThis())
return string.Format(CultureInfo.InvariantCulture, "{0}", _ado.AddslashesProcessParam(obj, mapType, mapColumn));
if (obj is Array && objType.GetElementType()?.NullableTypeOrThis() == mapColumn.CsType?.NullableTypeOrThis())
return string.Format(CultureInfo.InvariantCulture, "{0}", _ado.AddslashesProcessParam(obj, mapType, mapColumn));
}
var type = mapType ?? mapColumn?.Attribute.MapType ?? obj?.GetType();
if (_common.CodeFirst.GetDbInfo(type) != null)
{