Browse Source

Update demo

pull/14/head
sunkaixuna 3 years ago
parent
commit
91ecf1e6a6
  1. 2
      Src/Asp.Net/MySqlConnectorTest/Config.cs
  2. 30
      Src/Asp.Net/MySqlConnectorTest/Demo/Demo3_Insertable.cs

2
Src/Asp.Net/MySqlConnectorTest/Config.cs

@ -16,7 +16,7 @@ namespace OrmTest
/// Account have permission to create database /// Account have permission to create database
/// 用有建库权限的数据库账号 /// 用有建库权限的数据库账号
/// </summary> /// </summary>
public static string ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql"; public static string ConnectionString = "server=localhost;Database=SqlSugar4xTest;Uid=root;Pwd=haosql;AllowLoadLocalInfile=true";
/// <summary> /// <summary>
/// Account have permission to create database /// Account have permission to create database
/// 用有建库权限的数据库账号 /// 用有建库权限的数据库账号

30
Src/Asp.Net/MySqlConnectorTest/Demo/Demo3_Insertable.cs

@ -51,21 +51,21 @@ namespace OrmTest
db.Insertable(insertObj).With(SqlWith.UpdLock).ExecuteCommand(); db.Insertable(insertObj).With(SqlWith.UpdLock).ExecuteCommand();
db.Deleteable<Order>().ExecuteCommand(); db.Deleteable<Order>().ExecuteCommand();
db.Insertable(new Order() //db.Insertable(new Order()
{ //{
CreateTime = DateTime.Now, // CreateTime = DateTime.Now,
CustomId = 11, // CustomId = 11,
Name = "11", // Name = "11",
Price = 11 // Price = 11
}).UseMySql().ExecuteBulkCopy(); //}).UseMySql().ExecuteBulkCopy();
db.Insertable(new OrderItem() //db.Insertable(new OrderItem()
{ //{
CreateTime = DateTime.Now, // CreateTime = DateTime.Now,
ItemId = 1, // ItemId = 1,
OrderId = 1, // OrderId = 1,
OrderName = "a", // OrderName = "a",
Price = 11 // Price = 11
}).UseMySql().ExecuteBulkCopy(); //}).UseMySql().ExecuteBulkCopy();
var data = db.Queryable<Order>().ToList(); var data = db.Queryable<Order>().ToList();
db.Insertable(data).UseMySql().ExecuteBulkCopy(); db.Insertable(data).UseMySql().ExecuteBulkCopy();
db.Fastest<Order>().BulkUpdate(data); db.Fastest<Order>().BulkUpdate(data);

Loading…
Cancel
Save