diff --git a/Src/Asp.Net/OracleTest/UnitTest/UAdo.cs b/Src/Asp.Net/OracleTest/UnitTest/UAdo.cs index 5f3a431cb..75bc96be2 100644 --- a/Src/Asp.Net/OracleTest/UnitTest/UAdo.cs +++ b/Src/Asp.Net/OracleTest/UnitTest/UAdo.cs @@ -11,47 +11,47 @@ namespace OrmTest public static void Ado() { - var task1 = Db.Ado.GetScalarAsync("select 1"); + var task1 = Db.Ado.GetScalarAsync("select 1 from dual"); task1.Wait(); UValidate.Check(1, task1.Result, "ado"); - var task2 = Db.Ado.GetIntAsync("select 2"); + var task2 = Db.Ado.GetIntAsync("select 2 from dual"); task2.Wait(); UValidate.Check(2, task2.Result, "ado"); - var task3 = Db.Ado.GetLongAsync("select 3"); + var task3 = Db.Ado.GetLongAsync("select 3 from dual"); task3.Wait(); UValidate.Check(3, task3.Result, "ado"); - var task4 = Db.Ado.GetDataTableAsync("select 4 as id"); + var task4 = Db.Ado.GetDataTableAsync("select 4 as id from dual"); task4.Wait(); UValidate.Check(4, task4.Result.Rows[0]["id"], "ado"); - var task5 = Db.Ado.GetInt("select @id as id",new { id=5}); + var task5 = Db.Ado.GetInt("select @id as id from dual", new { id=5}); UValidate.Check(5, task5, "ado"); - var task6 = Db.Ado.SqlQuery("select @id as id", new { id = 5 }); - UValidate.Check(5, task6[0].id, "ado"); + var task6 = Db.Ado.SqlQuery("select @id as id from dual", new { id = 5 }); + UValidate.Check(5, task6[0].ID, "ado"); - var task7 = Db.Ado.SqlQueryAsync("select @id as id", new { id = 7 }); + var task7 = Db.Ado.SqlQueryAsync("select @id as id from dual", new { id = 7 }); task7.Wait(); - UValidate.Check(7, task7.Result[0].id, "ado"); + UValidate.Check(7, task7.Result[0].ID, "ado"); - var task8 = Db.Ado.SqlQueryAsync("select 8 as id"); + var task8 = Db.Ado.SqlQueryAsync("select 8 as id from dual"); task8.Wait(); - UValidate.Check(8, task8.Result[0].id, "ado"); + UValidate.Check(8, task8.Result[0].ID, "ado"); - var task9=Db.Ado.SqlQuery("select * from [order];select * from OrderDetail"); + //var task9=Db.Ado.SqlQuery("select * from [order];select * from OrderDetail"); - var task10 = Db.Ado.SqlQueryAsync("select * from [order];select * from OrderDetail"); - task10.Wait(); + //var task10 = Db.Ado.SqlQueryAsync("select * from [order];select * from OrderDetail"); + //task10.Wait(); } } } diff --git a/Src/Asp.Net/OracleTest/UnitTest/UJson.cs b/Src/Asp.Net/OracleTest/UnitTest/UJson.cs index f0c8de5b3..68d2bf263 100644 --- a/Src/Asp.Net/OracleTest/UnitTest/UJson.cs +++ b/Src/Asp.Net/OracleTest/UnitTest/UJson.cs @@ -13,12 +13,12 @@ namespace OrmTest { Db.CodeFirst.InitTables(); Db.DbMaintenance.TruncateTable(); - Db.Insertable(new UnitJsonTest() { Order = new Order { Id = 1, Name = "order1" } }).ExecuteCommand(); + Db.Insertable(new UnitJsonTest() { Id=1,Order2 = new Order { Id = 1, Name = "order1" } }).ExecuteCommand(); var list = Db.Queryable().ToList(); - UValidate.Check("order1", list.First().Order.Name, "Json"); - Db.Updateable(new UnitJsonTest() { Id = 1, Order = new Order { Id = 2, Name = "order2" } }).ExecuteCommand(); + UValidate.Check("order1", list.First().Order2.Name, "Json"); + Db.Updateable(new UnitJsonTest() { Id = 1, Order2 = new Order { Id = 2, Name = "order2" } }).ExecuteCommand(); list= Db.Queryable().ToList(); - UValidate.Check("order2", list.First().Order.Name, "Json"); + UValidate.Check("order2", list.First().Order2.Name, "Json"); var list2 = Db.Queryable().ToList(); } } @@ -29,6 +29,6 @@ namespace OrmTest [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } [SqlSugar.SugarColumn(ColumnDataType = "varchar(2000)", IsJson = true)] - public Order Order { get; set; } + public Order Order2 { get; set; } } } diff --git a/Src/Asp.Net/OracleTest/UnitTest/UQueryable.cs b/Src/Asp.Net/OracleTest/UnitTest/UQueryable.cs index aa0906ec0..7446e77ea 100644 --- a/Src/Asp.Net/OracleTest/UnitTest/UQueryable.cs +++ b/Src/Asp.Net/OracleTest/UnitTest/UQueryable.cs @@ -33,24 +33,24 @@ namespace OrmTest Db.Queryable().Where(it => SqlSugar.SqlFunc.Equals(it.CreateTime.Date, it.CreateTime.Date)).ToList(); - var sql = Db.Queryable().Select(it => new UnitSelectTest() - { - - DcNull = it.Dc, - Dc = it.Int - }).ToSql().Key; - UValidate.Check(sql, "SELECT [Dc] AS [DcNull] , [Int] AS [Dc] FROM [UnitSelectTest]", "Queryable"); - - sql = Db.Updateable(new UnitSelectTest2()).ToSql().Key; - UValidate.Check(sql, @"UPDATE [UnitSelectTest2] SET - [Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable"); - - sql = Db.Queryable().IgnoreColumns(it => it.CreateTime).ToSql().Key; - UValidate.Check(sql, "SELECT [Id],[Name],[Price],[CustomId] FROM [Order] ", "Queryable"); - sql = Db.Queryable().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key; - UValidate.Check(sql, "SELECT [Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); - sql = Db.Queryable().IgnoreColumns("id").ToSql().Key; - UValidate.Check(sql, "SELECT [Name],[Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); + // var sql = Db.Queryable().Select(it => new UnitSelectTest() + // { + + // DcNull = it.Dc, + // Dc = it.Int + // }).ToSql().Key; + // UValidate.Check(sql, "SELECT [Dc] AS [DcNull] , [Int] AS [Dc] FROM [UnitSelectTest]", "Queryable"); + + // sql = Db.Updateable(new UnitSelectTest2()).ToSql().Key; + // UValidate.Check(sql, @"UPDATE [UnitSelectTest2] SET + //[Dc]=@Dc,[IntNull]=@IntNull WHERE [Int]=@Int", "Queryable"); + + // sql = Db.Queryable().IgnoreColumns(it => it.CreateTime).ToSql().Key; + // UValidate.Check(sql, "SELECT [Id],[Name],[Price],[CustomId] FROM [Order] ", "Queryable"); + // sql = Db.Queryable().IgnoreColumns(it => new { it.Id, it.Name }).ToSql().Key; + // UValidate.Check(sql, "SELECT [Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); + // sql = Db.Queryable().IgnoreColumns("id").ToSql().Key; + // UValidate.Check(sql, "SELECT [Name],[Price],[CreateTime],[CustomId] FROM [Order] ", "Queryable"); var cts = IEnumerbleContains.Data(); var list2=Db.Queryable()