diff --git a/Src/Asp.Net/MySqlConnectorTest/Config.cs b/Src/Asp.Net/MySqlConnectorTest/Config.cs index 6c8f50d64..d5287e424 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Config.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Config.cs @@ -16,17 +16,17 @@ namespace OrmTest /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql;AllowLoadLocalInfile=true"; + public static string ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=123456;AllowLoadLocalInfile=true"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString2 = "server=localhost;Database=SqlSugar4xTest2;Uid=root;Pwd=haosql"; + public static string ConnectionString2 = "server=localhost;Database=SqlSugar4xTest2;Uid=root;Pwd=123456"; /// /// Account have permission to create database /// 用有建库权限的数据库账号 /// - public static string ConnectionString3 = "server=localhost;Database=SqlSugar4xTest3;Uid=root;Pwd=haosql"; + public static string ConnectionString3 = "server=localhost;Database=SqlSugar4xTest3;Uid=root;Pwd=123456"; /***注意:如果报错:指字关键词不在字典中这说明需要更新MYSQL.DATA驱动到最新,不报错就不需要更新***/ diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo1_Queryable.cs index a1734d2f3..f3b0aadea 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo1_Queryable.cs @@ -188,7 +188,7 @@ namespace OrmTest var db = GetInstance(); //Creater Table db.CodeFirst.InitTables(typeof(Tree)); - db.DbMaintenance.TruncateTable("tree"); + db.DbMaintenance.TruncateTable("Tree"); db.Insertable(new Tree() { Id = 1, Name = "root" }).ExecuteCommand(); db.Insertable(new Tree() { Id = 11, Name = "child1",ParentId=1 }).ExecuteCommand(); db.Insertable(new Tree() { Id = 12, Name = "child2",ParentId=1 }).ExecuteCommand(); @@ -247,9 +247,9 @@ namespace OrmTest Console.WriteLine("#### No Entity Start ####"); var db = GetInstance(); - var list = db.Queryable().AS("order").Where("id=id", new { id = 1 }).ToList(); + var list = db.Queryable().AS("Order").Where("id=id", new { id = 1 }).ToList(); - var list2 = db.Queryable("o").AS("order").AddJoinInfo("OrderDetail", "i", "o.id=i.OrderId").Where("id=id", new { id = 1 }).Select("o.*").ToList(); + var list2 = db.Queryable("o").AS("Order").AddJoinInfo("OrderDetail", "i", "o.id=i.OrderId").Where("id=id", new { id = 1 }).Select("o.*").ToList(); Console.WriteLine("#### No Entity End ####"); } diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo2_Updateable.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo2_Updateable.cs index 8333efc99..8b41b3b68 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo2_Updateable.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo2_Updateable.cs @@ -78,8 +78,8 @@ namespace OrmTest var dtList = new List>(); dtList.Add(dt); - var t66 = db.Updateable(dt).AS("`order`").WhereColumns("id").ExecuteCommand(); - var t666 = db.Updateable(dtList).AS("`order`").WhereColumns("id").ExecuteCommand(); + var t66 = db.Updateable(dt).AS("`Order`").WhereColumns("id").ExecuteCommand(); + var t666 = db.Updateable(dtList).AS("`Order`").WhereColumns("id").ExecuteCommand(); diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo5_SqlQueryable.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo5_SqlQueryable.cs index f350c18aa..fef0d7b8e 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo5_SqlQueryable.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo5_SqlQueryable.cs @@ -22,13 +22,13 @@ namespace OrmTest }); int total = 0; - var list = db.SqlQueryable("select * from `order`").ToPageList(1, 2, ref total); + var list = db.SqlQueryable("select * from `Order`").ToPageList(1, 2, ref total); //by expression - var list2 = db.SqlQueryable("select * from `order`").Where(it => it.Id == 1).ToPageList(1, 2); + var list2 = db.SqlQueryable("select * from `Order`").Where(it => it.Id == 1).ToPageList(1, 2); //by sql - var list3 = db.SqlQueryable("select * from `order`").Where("id=@id", new { id = 1 }).ToPageList(1, 2); + var list3 = db.SqlQueryable("select * from `Order`").Where("id=@id", new { id = 1 }).ToPageList(1, 2); Console.WriteLine("#### SqlQueryable End ####"); } diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo6_Queue.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo6_Queue.cs index c283022bc..06a218bc4 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo6_Queue.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo6_Queue.cs @@ -43,7 +43,7 @@ namespace OrmTest db.Queryable().AddQueue(); db.Queryable().AddQueue(); - db.AddQueue("select * from `order` where id=@id", new { id = 10000 }); + db.AddQueue("select * from `Order` where id=@id", new { id = 10000 }); var result2 = db.SaveQueues(); Console.WriteLine("#### Queue End ####"); diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo7_Ado.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo7_Ado.cs index c454ce9ff..3879123b6 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Demo7_Ado.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Demo7_Ado.cs @@ -30,13 +30,13 @@ namespace OrmTest } }); //sql - var dt = db.Ado.GetDataTable("select * from `order` where @id>0 or name=@name", new List(){ + var dt = db.Ado.GetDataTable("select * from `Order` where @id>0 or name=@name", new List(){ new SugarParameter("@id",1), new SugarParameter("@name","2") }); //sql - var dt2 = db.Ado.GetDataTable("select * from `order` where @id>0 or name=@name", new { id = 1, name = "2" }); + var dt2 = db.Ado.GetDataTable("select * from `Order` where @id>0 or name=@name", new { id = 1, name = "2" }); //Stored Procedure //var dt3 = db.Ado.UseStoredProcedure().GetDataTable("sp_school", new { name = "张三", age = 0 }); @@ -47,11 +47,11 @@ namespace OrmTest //There are many methods to under db.ado - var list= db.Ado.SqlQuery("select * from `order` "); - var list2 = db.Ado.SqlQuery("select * from `order` where 1=2;select * from `order` "); - var list3 = db.Ado.SqlQuery(" delete from `order` where 2=15 "); + var list= db.Ado.SqlQuery("select * from `Order` "); + var list2 = db.Ado.SqlQuery("select * from `Order` where 1=2;select * from `Order` "); + var list3 = db.Ado.SqlQuery(" delete from `Order` where 2=15 "); var intValue=db.Ado.SqlQuerySingle("select 1"); - db.Ado.ExecuteCommand("delete from `order` where id>1000"); + db.Ado.ExecuteCommand("delete from `Order` where id>1000"); //db.Ado.xxx Console.WriteLine("#### Ado End ####"); } diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/DemoF_Utilities.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/DemoF_Utilities.cs index 4a83664d9..d1d443502 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/DemoF_Utilities.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/DemoF_Utilities.cs @@ -37,7 +37,7 @@ namespace OrmTest Console.WriteLine(string.Join("," ,list)); }); - var list2= db.Utilities.DataTableToList(db.Ado.GetDataTable("select * from `order`")); + var list2= db.Utilities.DataTableToList(db.Ado.GetDataTable("select * from `Order`")); //more https://github.com/sunkaixuan/SqlSugar/wiki/f.Utilities Console.WriteLine("#### Utilities End ####"); diff --git a/Src/Asp.Net/MySqlConnectorTest/Demo/Democ_GobalFilter.cs b/Src/Asp.Net/MySqlConnectorTest/Demo/Democ_GobalFilter.cs index 33e6e1413..abeb6636c 100644 --- a/Src/Asp.Net/MySqlConnectorTest/Demo/Democ_GobalFilter.cs +++ b/Src/Asp.Net/MySqlConnectorTest/Demo/Democ_GobalFilter.cs @@ -16,21 +16,21 @@ namespace OrmTest var sql = db.Queryable().ToSql(); - //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE isDelete=0 + //SELECT [Id],[Name],[Price],[CreateTime] FROM `Order` WHERE isDelete=0 Console.WriteLine(sql); var sql2 = db.Queryable((main,ot)=> main.Id==ot.OrderId).ToSql(); - //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` main ,[OrderDetail] ot WHERE ( [main].[Id] = [ot].[OrderId] ) AND main.isDelete=0 + //SELECT [Id],[Name],[Price],[CreateTime] FROM `Order` main ,[OrderDetail] ot WHERE ( [main].[Id] = [ot].[OrderId] ) AND main.isDelete=0 Console.WriteLine(sql2); var sql3 = db.Queryable().Filter("Myfilter").ToSql();// Myfilter+Gobal - //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE Name='jack' AND isDelete=0 + //SELECT [Id],[Name],[Price],[CreateTime] FROM `Order` WHERE Name='jack' AND isDelete=0 Console.WriteLine(sql3); var sql4 = db.Queryable().Filter("Myfilter",isDisabledGobalFilter:true).ToSql();//only Myfilter - //SELECT [Id],[Name],[Price],[CreateTime] FROM `order` WHERE Name='jack' + //SELECT [Id],[Name],[Price],[CreateTime] FROM `Order` WHERE Name='jack' Console.WriteLine(sql4); Console.WriteLine("#### Filter End ####"); } diff --git a/Src/Asp.Net/MySqlConnectorTest/UnitTest/UAdo.cs b/Src/Asp.Net/MySqlConnectorTest/UnitTest/UAdo.cs index f2578cf29..7b2c31d7f 100644 --- a/Src/Asp.Net/MySqlConnectorTest/UnitTest/UAdo.cs +++ b/Src/Asp.Net/MySqlConnectorTest/UnitTest/UAdo.cs @@ -48,9 +48,9 @@ namespace OrmTest task8.Wait(); 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"); + var task10 = Db.Ado.SqlQueryAsync("select * from `Order`;select * from OrderDetail"); task10.Wait(); } }