diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubDistinctCount.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubDistinctCount.cs index 9dce7b297..affccb879 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubDistinctCount.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubDistinctCount.cs @@ -44,6 +44,7 @@ namespace SqlSugar { var exp = expression as MethodCallExpression; var argExp = exp.Arguments[0]; + InitType(exp); var parametres = (argExp as LambdaExpression).Parameters; if ((argExp as LambdaExpression).Body is UnaryExpression) { @@ -64,5 +65,17 @@ namespace SqlSugar result = result.Replace(selfParameterName, SubTools.GetSubReplace(this.Context)); return result; } + private void InitType(MethodCallExpression exp) + { + foreach (var arg in (exp.Arguments[0] as LambdaExpression).Parameters) + { + if (this.Context.InitMappingInfo != null) + { + this.Context.InitMappingInfo(arg.Type); + this.Context.RefreshMapping(); + } + } + } + } } diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec index ae5fbcf85..795f2504d 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec @@ -2,7 +2,7 @@ SqlSugarCore - 5.1.3.24 + 5.1.3.25-preview03 sunkaixuan 果糖大数据科技 http://www.apache.org/licenses/LICENSE-2.0.html