mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update unit test
This commit is contained in:
parent
c9a7e4ad37
commit
9ae235746e
@ -56,7 +56,35 @@ namespace OrmTest
|
||||
{
|
||||
throw new Exception("unit Bulk");
|
||||
}
|
||||
Db.CodeFirst.InitTables<UnitIdentity111>();
|
||||
Db.DbMaintenance.TruncateTable<UnitIdentity111>();
|
||||
var count = Db.Fastest<UnitIdentity111111111>().AS("UnitIdentity111").BulkCopy(new List<UnitIdentity111111111> {
|
||||
new UnitIdentity111111111(){ Id=1, Name="jack" }
|
||||
});
|
||||
if (count == 0)
|
||||
{
|
||||
throw new Exception("unit Bulk");
|
||||
}
|
||||
count = Db.Fastest<UnitIdentity111111111>().AS("UnitIdentity111").BulkUpdate(new List<UnitIdentity111111111> {
|
||||
new UnitIdentity111111111(){ Id=1, Name="jack" }
|
||||
});
|
||||
if (count == 0)
|
||||
{
|
||||
throw new Exception("unit Bulk");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UnitIdentity111
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class UnitIdentity111111111
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class UnitIdentity1
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace OrmTest
|
||||
}
|
||||
}
|
||||
});
|
||||
public static SqlSugarClient singleDb = new SqlSugarClient(new ConnectionConfig()
|
||||
public static SqlSugarScope singleDb = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
DbType = DbType.MySql,
|
||||
ConnectionString = Config.ConnectionString,
|
||||
|
@ -64,8 +64,10 @@ namespace SqlSugar
|
||||
}
|
||||
public override async Task CreateTempAsync<T>(DataTable dt)
|
||||
{
|
||||
var queryable = this.Context.Queryable<T>();
|
||||
var tableName = queryable.SqlBuilder.GetTranslationTableName(dt.TableName);
|
||||
dt.TableName = "temp"+SnowFlakeSingle.instance.getID();
|
||||
var sql = this.Context.Queryable<T>().Where(it => false).ToSql().Key;
|
||||
var sql = queryable.AS(tableName).Where(it => false).ToSql().Key;
|
||||
await this.Context.Ado.ExecuteCommandAsync($"Create TEMPORARY table {dt.TableName}({sql}) ");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user