diff --git a/Examples/base_entity/Program.cs b/Examples/base_entity/Program.cs index 4ca086f5..d844a202 100644 --- a/Examples/base_entity/Program.cs +++ b/Examples/base_entity/Program.cs @@ -439,6 +439,16 @@ namespace base_entity BaseEntity.Initialization(fsql, () => _asyncUow.Value); #endregion + + var tttsqlext01 = fsql.Select().ToSql(a => new + { + cou = SqlExt.Count(1).Over().PartitionBy(a.Id).ToValue(), + avg = SqlExt.Avg(1).Over().PartitionBy(a.Id).ToValue() + + }); + + + //fsql.CodeFirst.SyncStructure(); fsql.CodeFirst.Entity(a => a.Property(p => p.code).IsRequired()); diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index 26522f10..537315e2 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -800,14 +800,5 @@ - - - 批量注入 Repository,可以参考代码自行调整 - - - - - - diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index c709a5a9..44495b3a 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -1019,6 +1019,9 @@ namespace FreeSql.Internal } else if (exp3.Arguments[a].IsParameter()) exp3InvokeParams[a] = exp3.Arguments[a].Type.CreateInstanceGetDefaultValue(); + + else if (Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(exp3.Arguments[a].Type.NullableTypeOrThis()) == false) + exp3InvokeParams[a] = exp3.Arguments[a].Type.CreateInstanceGetDefaultValue(); else { var exp3CsValue = eccContent.StartsWith("N'") ? @@ -1045,8 +1048,8 @@ namespace FreeSql.Internal typeof(ThreadLocal).GetProperty("Value").SetValue(eccField.GetValue(null), ecc, null); try { - var sqlRet = exp3.Method.Invoke(null, exp3InvokeParams); - if (string.IsNullOrEmpty(ecc.Result) && sqlRet is string) ecc.Result = string.Concat(sqlRet); + var invokeReturn = exp3.Method.Invoke(null, exp3InvokeParams); + if (string.IsNullOrEmpty(ecc.Result) && invokeReturn is string) ecc.Result = string.Concat(invokeReturn); if (string.IsNullOrEmpty(ecc.Result) && exp3MethodParams.Any()) ecc.Result = ecc.ParsedContent[exp3MethodParams[0].Name]; if (ecc.UserParameters?.Any() == true) tsc.dbParams?.AddRange(ecc.UserParameters); return ecc.Result;