Skip to content

Commit e2d6c89

Browse files
committed
update Exception message
1 parent 98e9430 commit e2d6c89

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

FreeSql.Tests/FreeSql.Tests/SqlServer/SqlServerExpression/OtherTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using FreeSql.DataAnnotations;
1+
using FreeSql.DataAnnotations;
22
using FreeSql.Tests.DataContext.SqlServer;
33
using System;
44
using System.Collections.Generic;

FreeSql/Internal/CommonExpression.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,33 @@ public static void ParseExpressionNoAsSelect(object sender, Aop.ParseExpressionE
19541954
return;
19551955
}
19561956
exp3tmp = exp3Stack.Pop();
1957-
if (exp3tmp.NodeType != ExpressionType.Parameter) return;
1957+
if (exp3tmp.NodeType != ExpressionType.Parameter)
1958+
{
1959+
//if (e.Expression.NodeType == ExpressionType.Call)
1960+
//{
1961+
// var rootExpCall = e.Expression as MethodCallExpression;
1962+
// if (rootExpCall.Object == null && rootExpCall.Method.Name == "Any" &&
1963+
// rootExpCall.Arguments.Count == 2 &&
1964+
// rootExpCall.Arguments[0].Type.GetGenericTypeDefinition() == typeof(IEnumerable<>) &&
1965+
// rootExpCall.Arguments[1].Type == typeof(Func<,>).MakeGenericType(rootExpCall.Arguments[0].Type.GetGenericArguments()[0], typeof(bool)))
1966+
// {
1967+
// //e.Tables[0].Parameter
1968+
// var anyExp = rootExpCall.Arguments[1];
1969+
// while(anyExp.NodeType == ExpressionType.AndAlso)
1970+
// {
1971+
1972+
// }
1973+
// if (anyExp.NodeType != ExpressionType.AndAlso && anyExp.NodeType != ExpressionType.Equal) return;
1974+
1975+
1976+
// var array = Expression.Lambda(rootExpCall.Arguments[0]).Compile().DynamicInvoke() as IEnumerable;
1977+
// foreach (var arritem in array)
1978+
// {
1979+
// }
1980+
// }
1981+
//}
1982+
return;
1983+
}
19581984
if (exp3tmp.Type.FullName.StartsWith("FreeSql.ISelectGroupingAggregate")) return;
19591985
var commonExp = sender as FreeSql.Internal.CommonExpression;
19601986
if (commonExp == null) return;

FreeSql/Internal/CommonProvider/UpdateProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ public virtual void ToSqlWhere(StringBuilder sb)
10031003
sb.Append(" \r\nWHERE ");
10041004
if (_source.Any())
10051005
{
1006-
if (_tempPrimarys.Any() == false) throw new ArgumentException($"{_table.Type.DisplayCsharp()} 没有定义主键,无法使用 SetSource,请尝试 SetDto");
1006+
if (_tempPrimarys.Any() == false) throw new ArgumentException($"{_table.Type.DisplayCsharp()} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键");
10071007
sb.Append('(').Append(_commonUtils.WhereItems(_tempPrimarys, "", _source)).Append(')');
10081008
}
10091009

0 commit comments

Comments
 (0)