Browse Source

Synchronization code

pull/31/head
sunkaixuan 2 years ago
parent
commit
f2e7505002
  1. 11
      Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

11
Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs

@ -388,6 +388,10 @@ namespace SqlSugar
{
result.Add(name, DeserializeObject<Dictionary<string, object>>(readerValues.First(it => it.Key.EqualCase(name)).Value.ObjToString()));
}
else if (IsArrayItem(readerValues, item))
{
result.Add(name, DeserializeObject<string[]>(readerValues.First(y => y.Key.EqualCase(item.Name)).Value + ""));
}
else if (IsJsonList(readerValues, item))
{
var json = readerValues.First(y => y.Key.EqualCase(item.Name)).Value.ToString();
@ -453,6 +457,7 @@ namespace SqlSugar
return result;
}
private void SetAppendColumns(IDataReader dataReader)
{
if (QueryBuilder != null && QueryBuilder.AppendColumns != null && QueryBuilder.AppendColumns.Any())
@ -498,6 +503,12 @@ namespace SqlSugar
Regex.IsMatch(readerValues.First().Value.ObjToString(), @"^\{.+\}$");
}
private static bool IsArrayItem(Dictionary<string, object> readerValues, PropertyInfo item)
{
return item.PropertyType.IsArray && readerValues.Any(y => y.Key.EqualCase(item.Name)) && readerValues.FirstOrDefault(y => y.Key.EqualCase(item.Name)).Value is string;
}
private static bool IsJsonList(Dictionary<string, object> readerValues, PropertyInfo item)
{
return item.PropertyType.FullName.IsCollectionsList() &&

Loading…
Cancel
Save