提交 0025c7f3 编写于 作者: s0611163's avatar s0611163

v1.8.19 修复Lambda表达式写法集合Contains不支持ClickHouse的问题

上级 548ccdaf
......@@ -5,9 +5,9 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<AssemblyVersion>1.8.18</AssemblyVersion>
<FileVersion>1.8.18</FileVersion>
<Version>1.8.18</Version>
<AssemblyVersion>1.8.19</AssemblyVersion>
<FileVersion>1.8.19</FileVersion>
<Version>1.8.19</Version>
</PropertyGroup>
<ItemGroup>
......
......@@ -155,14 +155,14 @@ namespace Dapper.LiteSql
if (sqlValue.Value.GetType().Name != typeof(List<>).Name)
{
string markKey = _provider.GetParameterName(key, parameterType);
sql = sql.Replace(markKey, string.Format(sqlValue.Sql, markKey));
sql = sql.Replace(markKey, sqlValue.Sql.Replace("{0}", markKey));
DbParameter param = _provider.GetDbParameter(key, sqlValue.Value);
_params.Add(param.ParameterName, param);
}
else
{
string markKey = _provider.GetParameterName(key, parameterType);
sql = sql.Replace(markKey, string.Format(sqlValue.Sql, markKey));
sql = sql.Replace(markKey, sqlValue.Sql.Replace("{0}", markKey));
string[] keyArr = sqlValue.Sql.Replace("(", string.Empty).Replace(")", string.Empty).Replace("@", string.Empty).Split(',');
IList valueList = (IList)sqlValue.Value;
for (int k = 0; k < valueList.Count; k++)
......
......@@ -208,7 +208,7 @@ namespace Dapper.LiteSql
string markKey = _provider.GetParameterName(left.MemberAliasName, parameterType);
result.DbParameters.Add(_provider.GetDbParameter(left.MemberAliasName, right.Value));
result.Sql = string.Format(" ({0}.{1} {2} {3}) ", left.MemberParentName, left.MemberDBField, ToSqlOperator(exp.NodeType), string.Format(sqlValue.Sql, markKey));
result.Sql = string.Format(" ({0}.{1} {2} {3}) ", left.MemberParentName, left.MemberDBField, ToSqlOperator(exp.NodeType), sqlValue.Sql.Replace("{0}", markKey));
}
else
{
......@@ -257,7 +257,7 @@ namespace Dapper.LiteSql
not = "not";
}
result.Sql = string.Format("{0}.{1} {2} like {3}", expValue.MemberParentName, expValue.MemberDBField, not, string.Format(sqlValue.Sql, markKey));
result.Sql = string.Format("{0}.{1} {2} like {3}", expValue.MemberParentName, expValue.MemberDBField, not, sqlValue.Sql.Replace("{0}", markKey));
result.DbParameters.Add(_provider.GetDbParameter(expValue.MemberAliasName, sqlValue.Value));
}
else // 支持 in 和 not in 例: t => idList.Contains(t.Id)
......@@ -297,7 +297,7 @@ namespace Dapper.LiteSql
inOrNotIn = "in";
}
result.Sql = string.Format("{0}.{1} {2} {3}", expValue.MemberParentName, expValue.MemberDBField, inOrNotIn, string.Format(sqlValue.Sql, markKey));
result.Sql = string.Format("{0}.{1} {2} {3}", expValue.MemberParentName, expValue.MemberDBField, inOrNotIn, sqlValue.Sql.Replace("{0}", markKey));
string[] keyArr = sqlValue.Sql.Replace("(", string.Empty).Replace(")", string.Empty).Replace("@", string.Empty).Split(',');
IList valueList = (IList)sqlValue.Value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册