Browse Source

Update demo

pull/4/MERGE
sunkaixuna 3 years ago
parent
commit
835285be27
  1. 17
      Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs
  2. 4
      Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs
  3. 10
      Src/Asp.Net/SqlServerTest/UnitTest/Updateable.cs

17
Src/Asp.Net/PgSqlTest/UnitTest/Updateable.cs

@ -59,8 +59,25 @@ namespace OrmTest
CreateTime = null
}).Where(it => it.Id == 1).ExecuteCommand();
Db.CodeFirst.InitTables<BoolTest1>();
Db.Updateable<BoolTest1>()
.SetColumns(it => it.a == !it.a)
.Where(it => it.a)
.ExecuteCommand();
Db.Updateable<BoolTest1>()
.SetColumns(it => new BoolTest1() { a = !it.a })
.Where(it => it.a)
.ExecuteCommand();
}
}
public class BoolTest1
{
public bool a { get; set; }
}
[SugarTable("order")]
public class OrderModel
{

4
Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs

@ -146,6 +146,10 @@ namespace OrmTest
b = it.bytes,
name="a"
}).ToList();
db.CodeFirst.InitTables<BoolTest1>();
db.CodeFirst.InitTables<BoolTest2>();
db.Queryable<BoolTest1>().Where(it => !it.a).ToList();
}

10
Src/Asp.Net/SqlServerTest/UnitTest/Updateable.cs

@ -104,6 +104,16 @@ namespace OrmTest
Db.CodeFirst.InitTables<Unitbluecopy>();
Db.Insertable(new Unitbluecopy()).UseSqlServer().ExecuteBlueCopy();
Db.CodeFirst.InitTables<BoolTest1>();
Db.Updateable<BoolTest1>()
.SetColumns(it =>it.a== !it.a)
.Where(it=>it.a)
.ExecuteCommand();
Db.Updateable<BoolTest1>()
.SetColumns(it=>new BoolTest1() { a = !it.a })
.Where(it => it.a)
.ExecuteCommand();
}
}

Loading…
Cancel
Save