From 2c76e043de192bdc1b457c253b4569c196e77ed2 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 27 Apr 2022 20:31:51 +0800 Subject: [PATCH] Update Select Json Bug --- .../SqlSugar/Infrastructure/ContextMethods.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs index 9f3dae42c..cd507473d 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs @@ -294,7 +294,8 @@ namespace SqlSugar } else if (IsJsonList(readerValues, item)) { - result.Add(name, DeserializeObject>>(readerValues[item.Name.ToLower()].ToString())); + var json = readerValues.First(y => y.Key.EqualCase(item.Name)).Value.ToString(); + result.Add(name, DeserializeObject>>(json)); } else if (IsBytes(readerValues, item)) { @@ -374,10 +375,10 @@ namespace SqlSugar private static bool IsJsonList(Dictionary readerValues, PropertyInfo item) { return item.PropertyType.FullName.IsCollectionsList() && - readerValues.ContainsKey(item.Name.ToLower()) && - readerValues[item.Name.ToLower()] != null && - readerValues[item.Name.ToLower()].GetType() == UtilConstants.StringType && - Regex.IsMatch(readerValues[item.Name.ToLower()].ToString(), @"^\[{.+\}]$"); + readerValues.Any(y=>y.Key.EqualCase(item.Name)) && + readerValues.First(y => y.Key.EqualCase(item.Name)).Value != null && + readerValues.First(y => y.Key.EqualCase(item.Name)).Value.GetType() == UtilConstants.StringType && + Regex.IsMatch(readerValues.First(y => y.Key.EqualCase(item.Name)).Value.ToString(), @"^\[{.+\}]$"); } private Dictionary DataReaderToDynamicList_Part(Dictionary readerValues, PropertyInfo item, List reval, Dictionary mappingKeys=null)