mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add unit test
This commit is contained in:
parent
37641a0686
commit
3f29e6b0aa
@ -37,9 +37,30 @@ namespace OrmTest
|
||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||
db.CodeFirst.InitTables<CodeFirstLong>();
|
||||
var tableInfo=db.DbMaintenance.GetColumnInfosByTableName("CodeFirstLong", false);
|
||||
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
|
||||
{
|
||||
IsAutoToUpper = false
|
||||
};
|
||||
db.CodeFirst.InitTables<CodeFirstNoUpper>();
|
||||
db.Insertable(new CodeFirstNoUpper() { Id = Guid.NewGuid() + "", Name = "a" }).ExecuteCommand();
|
||||
var list2= db.Queryable<CodeFirstNoUpper>().Where(it=>it.Id!=null).ToList();
|
||||
db.Updateable(list2).ExecuteCommand();
|
||||
db.Deleteable(list2).ExecuteCommand();
|
||||
db.Updateable(list2.First()).ExecuteCommand();
|
||||
db.Deleteable<CodeFirstNoUpper>().Where(it => it.Id != null).ExecuteCommand();
|
||||
db.Updateable<CodeFirstNoUpper>().SetColumns(it=>it.Name=="a").Where(it => it.Id != null).ExecuteCommand();
|
||||
db.Updateable<CodeFirstNoUpper>().SetColumns(it =>new CodeFirstNoUpper() {
|
||||
Name="a"
|
||||
} ).Where(it => it.Id != null).ExecuteCommand();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
public class CodeFirstNoUpper
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey =true)]
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class CodeFirstLong
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user