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
/// 用有建库权限的数据库账号
/// </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>
/// 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.Deleteable<Order>().ExecuteCommand();
db.Insertable(new Order()
{
CreateTime = DateTime.Now,
CustomId = 11,
Name = "11",
Price = 11
}).UseMySql().ExecuteBulkCopy();
db.Insertable(new OrderItem()
{
CreateTime = DateTime.Now,
ItemId = 1,
OrderId = 1,
OrderName = "a",
Price = 11
}).UseMySql().ExecuteBulkCopy();
//db.Insertable(new Order()
//{
// CreateTime = DateTime.Now,
// CustomId = 11,
// Name = "11",
// Price = 11
//}).UseMySql().ExecuteBulkCopy();
//db.Insertable(new OrderItem()
//{
// CreateTime = DateTime.Now,
// ItemId = 1,
// OrderId = 1,
// OrderName = "a",
// Price = 11
//}).UseMySql().ExecuteBulkCopy();
var data = db.Queryable<Order>().ToList();
db.Insertable(data).UseMySql().ExecuteBulkCopy();
db.Fastest<Order>().BulkUpdate(data);

Loading…
Cancel
Save