Update Demo

This commit is contained in:
skx 2021-02-02 00:56:24 +08:00
parent a9e60d2019
commit 4b68efd836

View File

@ -19,8 +19,8 @@ namespace PerformanceTest
{ {
InitData(); InitData();
var type = DemoType.Like; var type = DemoType.OneToMany;
var ormType = OrmType.FREE; var ormType = OrmType.SqlSugar;
switch (type) switch (type)
{ {
case DemoType.GetAll: case DemoType.GetAll:
@ -38,7 +38,7 @@ namespace PerformanceTest
case DemoType.Like: case DemoType.Like:
new TestLike().Init(ormType); new TestLike().Init(ormType);
break; break;
case DemoType.OnToN: case DemoType.OneToMany:
new TestOneToMany().Init(ormType); new TestOneToMany().Init(ormType);
break; break;
default: default:
@ -78,16 +78,19 @@ namespace PerformanceTest
} }
} }
conn.CodeFirst.InitTables<Group>(); conn.CodeFirst.InitTables<Group>();
conn.DbMaintenance.TruncateTable<Group>(); // conn.DbMaintenance.TruncateTable<Group>();
conn.CodeFirst.InitTables<User>(); conn.CodeFirst.InitTables<User>();
conn.DbMaintenance.TruncateTable<User>(); //conn.DbMaintenance.TruncateTable<User>();
//for (int i = 0; i < 1000; i++) if (conn.Queryable<Group>().Count() < 500)
//{ {
// conn.Insertable(new Group { Id=i,Name=i+Guid.NewGuid().ToString() }).ExecuteCommand(); for (int i = 0; i < 1000; i++)
// conn.Insertable(new User() { AGroupId = i, Id = i + 1 }).ExecuteCommand(); {
// conn.Insertable(new User() { AGroupId = i, Id = i + 200000 }).ExecuteCommand(); conn.Insertable(new Group { Id = i, Name = i + Guid.NewGuid().ToString() }).ExecuteCommand();
//} conn.Insertable(new User() { AGroupId = i, Id = i + 1 }).ExecuteCommand();
conn.Insertable(test).ExecuteCommand(); conn.Insertable(new User() { AGroupId = i, Id = i + 200000 }).ExecuteCommand();
}
conn.Insertable(test).ExecuteCommand();
}
} }
enum DemoType enum DemoType
@ -97,7 +100,7 @@ namespace PerformanceTest
GetSql, GetSql,
Insert, Insert,
Like, Like,
OnToN OneToMany
} }
} }
} }