mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update json
This commit is contained in:
parent
936936154a
commit
35b7926944
@ -18,7 +18,7 @@ namespace OrmTest
|
|||||||
});
|
});
|
||||||
|
|
||||||
db.CodeFirst.InitTables<Test2>();
|
db.CodeFirst.InitTables<Test2>();
|
||||||
|
db.DbMaintenance.TruncateTable<Test2>();
|
||||||
//用例代码
|
//用例代码
|
||||||
db.Insertable(new Test2() { p = "1" }).ExecuteCommand();//用例代码
|
db.Insertable(new Test2() { p = "1" }).ExecuteCommand();//用例代码
|
||||||
|
|
||||||
|
@ -26,6 +26,14 @@ namespace OrmTest
|
|||||||
.SetColumns(it => it.Name=="a")
|
.SetColumns(it => it.Name=="a")
|
||||||
.Where(it=>it.Id==1)
|
.Where(it=>it.Id==1)
|
||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
|
var list3=Db.Queryable<UnitJsonTest>().Select(it => new
|
||||||
|
{
|
||||||
|
x = it
|
||||||
|
}).ToList();
|
||||||
|
if (list3[0].x == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,9 +402,24 @@ namespace SqlSugar
|
|||||||
if (suagrColumn != null && suagrColumn.IsJson)
|
if (suagrColumn != null && suagrColumn.IsJson)
|
||||||
{
|
{
|
||||||
var key = (typeName + "." + name).ToLower();
|
var key = (typeName + "." + name).ToLower();
|
||||||
if (readerValues.ContainsKey(key)&& readerValues[key]!=null)
|
if (readerValues.Any(it=>it.Key.EqualCase(key)))
|
||||||
|
{
|
||||||
|
var jsonString = readerValues.First(it => it.Key.EqualCase(key)).Value;
|
||||||
|
if (jsonString != null)
|
||||||
|
{
|
||||||
|
if (jsonString.ToString().First() == '{'&& jsonString.ToString().Last() == '}')
|
||||||
|
{
|
||||||
|
result.Add(name, this.DeserializeObject<Dictionary<string, object>>(jsonString + ""));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.Add(name, this.DeserializeObject<List<Dictionary<string, object>>>(jsonString + ""));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
result.Add(name,this.DeserializeObject<List<Dictionary<string,object>>>(readerValues[key]+""));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user