mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-15 05:13:27 +08:00
Add unit test
This commit is contained in:
parent
743d14c8aa
commit
553e87547d
@ -1,4 +1,5 @@
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using SqlSugar.DbConvert;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -19,17 +20,26 @@ namespace OrmTest
|
|||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
});
|
});
|
||||||
db.DbMaintenance.CreateDatabase();
|
db.DbMaintenance.CreateDatabase();
|
||||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" ,CreateTime=DateTime.Now}).ExecuteCommand();
|
db.Insertable(new CodeFirstTable1() { Name = "a", Text = "a", CreateTime = DateTime.Now }).ExecuteCommand();
|
||||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||||
db.CodeFirst.InitTables<CodeFirst3311>();
|
db.CodeFirst.InitTables<CodeFirst3311>();
|
||||||
db.Insertable(new CodeFirst3311() { }).ExecuteCommand();
|
db.Insertable(new CodeFirst3311() { }).ExecuteCommand();
|
||||||
db.Insertable(new CodeFirst3311() { ts=DateTime.Now.TimeOfDay }).ExecuteCommand();
|
db.Insertable(new CodeFirst3311() { ts = DateTime.Now.TimeOfDay }).ExecuteCommand();
|
||||||
|
db.CodeFirst.InitTables<CodeFirstadfafaAA>();
|
||||||
|
db.Insertable(new CodeFirstadfafaAA() { Name = "0" }).ExecuteCommand();
|
||||||
|
var list3=db.Queryable<CodeFirstadfafaAA>().ToList();
|
||||||
Console.WriteLine("#### CodeFirst end ####");
|
Console.WriteLine("#### CodeFirst end ####");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class CodeFirstadfafaAA
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public int carry_status { get; set; }
|
||||||
|
}
|
||||||
public class CodeFirst3311
|
public class CodeFirst3311
|
||||||
{
|
{
|
||||||
[SugarColumn(IsNullable =true)]
|
[SugarColumn(IsNullable =true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user