- 修复 FromQueryMulti 多表重载可能出现的 null 对象报错;(合并 FromQuery 和 FromQueryMulti 代码)

This commit is contained in:
2881099
2023-03-15 22:54:22 +08:00
parent 357e52a59f
commit a157f8a0cc
7 changed files with 27 additions and 61 deletions

View File

@ -47,7 +47,7 @@ namespace FreeSql.Odbc.SqlServer
return (bool)param ? 1 : 0;
else if (param is string)
{
if (mapColumn != null && mapColumn.CsType.NullableTypeOrThis() == typeof(string) && ncharDbTypes.Any(a => mapColumn.Attribute.DbType.Contains(a)) == false)
if (mapColumn != null && mapColumn.CsType.NullableTypeOrThis() == typeof(string) && !string.IsNullOrWhiteSpace(mapColumn.Attribute.DbType) && ncharDbTypes.Any(a => mapColumn.Attribute.DbType.Contains(a)) == false)
return string.Concat("'", param.ToString().Replace("'", "''"), "'");
return string.Concat("N'", param.ToString().Replace("'", "''"), "'");
}