diff --git a/Src/Asp.Net/MySqlTest/UnitTest/UJson.cs b/Src/Asp.Net/MySqlTest/UnitTest/UJson.cs index 57de357f9..e93809b58 100644 --- a/Src/Asp.Net/MySqlTest/UnitTest/UJson.cs +++ b/Src/Asp.Net/MySqlTest/UnitTest/UJson.cs @@ -63,8 +63,25 @@ namespace OrmTest var list31 = db.Queryable().ToList(); var list3=db.Queryable().LeftJoin((t1, ti2) => t1.Id == ti2.fk) .Select((t1, ti2) => new { t1.Id, t1.Name,json= ti2.Json }).ToList(); + db.CodeFirst.InitTables(); + db.Insertable(new Unitaaar2() { arr = new string[] { "a", "c" } }).ExecuteCommand(); + var list141 = db.Queryable() + .Select(it => new { + x = SqlFunc.JsonIndex(it.arr, 0), + x2 = SqlFunc.JsonIndex(it.arr, 1) + }).ToList(); + if (list141.First().x != "a" && list141.Last().x != "c") + { + throw new Exception("unit error"); + } } - public class OrderMain11 + + public class Unitaaar2 + { + [SugarColumn(IsJson = true, IsNullable = true)] + public string[] arr { get; set; } + } + public class OrderMain11 { [SugarColumn(IsPrimaryKey = true,IsIdentity =true)] public int Id { get; set; } diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs index a1123793c..a994e3f2e 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs @@ -110,8 +110,25 @@ namespace OrmTest var list14=db.Queryable().ToList(); var list150 = db.Queryable().ToDictionary(it => it.Id, it => it.Order); var list15 = db.Queryable().ToDictionaryAsync(it=>it.Id,it=>it.Order).GetAwaiter().GetResult(); + + db.CodeFirst.InitTables(); + db.Insertable(new Unitaaar2() { arr = new string[] { "a", "c" } }).ExecuteCommand(); + var list141 = db.Queryable() + .Select(it => new { + x = SqlFunc.JsonIndex(it.arr, 0), + x2 = SqlFunc.JsonIndex(it.arr, 1) + }).ToList(); + if (list141.First().x != "a" && list141.Last().x != "c") + { + throw new Exception("unit error"); + } } } + public class Unitaaar2 + { + [SugarColumn(IsJson = true, IsNullable = true)] + public string[] arr { get; set; } + } public class UnitJsonTestadsga1 { [SqlSugar.SugarColumn(Length =2000,IsJson =true)]