mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 16:18:47 +08:00
Update demo
This commit is contained in:
parent
6309691b1a
commit
1804ac5c20
@ -11,26 +11,26 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public static void Updateable()
|
public static void Updateable()
|
||||||
{
|
{
|
||||||
Db.CodeFirst.InitTables(typeof(SYS_USER));
|
Db.CodeFirst.InitTables(typeof(UnitSYS_USER));
|
||||||
Db.DbMaintenance.TruncateTable<SYS_USER>();
|
Db.DbMaintenance.TruncateTable<UnitSYS_USER>();
|
||||||
Db.Insertable(new SYS_USER() { USER_ID=1,USER_ACCOUNT = "a", USER_PWD = "b", USER_NAME = "c", PWD_LASTCHTIME = DateTime.Now, PWD_ERRORCOUNT = 1, PWD_LASTERRTIME = DateTime.Now }).ExecuteCommand();
|
Db.Insertable(new UnitSYS_USER() { USER_ID=1,USER_ACCOUNT = "a", USER_PWD = "b", USER_NAME = "c", PWD_LASTCHTIME = DateTime.Now, PWD_ERRORCOUNT = 1, PWD_LASTERRTIME = DateTime.Now }).ExecuteCommand();
|
||||||
Db.Updateable(new SYS_USER() { USER_ID=1, PWD_LASTERRTIME = null }).WhereColumns(it=> new{ it.PWD_ERRORCOUNT, it.PWD_LASTERRTIME }).ExecuteCommand();
|
Db.Updateable(new UnitSYS_USER() { USER_ID=1, PWD_LASTERRTIME = null }).WhereColumns(it=> new{ it.PWD_ERRORCOUNT, it.PWD_LASTERRTIME }).ExecuteCommand();
|
||||||
Db.CodeFirst.InitTables(typeof(BoolTest));
|
Db.CodeFirst.InitTables(typeof(UnitBoolTest));
|
||||||
var x = new BoolTest();
|
var x = new UnitBoolTest();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = !it.BoolValue }).Where(it=>it.Id==1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { BoolValue = !it.BoolValue }).Where(it=>it.Id==1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == !it.BoolValue ).Where(it=>it.Id==1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => it.BoolValue == !it.BoolValue ).Where(it=>it.Id==1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { BoolValue = x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => it.BoolValue == x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => new BoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { BoolValue = !x.BoolValue }).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>().SetColumns(it => it.BoolValue == !x.BoolValue).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand();
|
||||||
Db.Updateable<BoolTest>(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SaveDiary saveDiary = new SaveDiary();
|
UnitSaveDiary saveDiary = new UnitSaveDiary();
|
||||||
saveDiary.ID = 2;
|
saveDiary.ID = 2;
|
||||||
saveDiary.TypeID = 10;
|
saveDiary.TypeID = 10;
|
||||||
saveDiary.TypeName = "类型100";
|
saveDiary.TypeName = "类型100";
|
||||||
@ -48,7 +48,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class SaveDiary
|
public class UnitSaveDiary
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int TypeID { get; set; }
|
public int TypeID { get; set; }
|
||||||
@ -62,7 +62,7 @@ namespace OrmTest
|
|||||||
/// 日记表
|
/// 日记表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("Diary")]
|
[SugarTable("Diary")]
|
||||||
public class Diary
|
public class UnitDiary
|
||||||
{
|
{
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
@ -124,7 +124,7 @@ namespace OrmTest
|
|||||||
public bool? IsDelete { get; set; }
|
public bool? IsDelete { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BoolTest
|
public class UnitBoolTest
|
||||||
{
|
{
|
||||||
[SugarColumn(IsPrimaryKey =true)]
|
[SugarColumn(IsPrimaryKey =true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
@ -135,7 +135,7 @@ namespace OrmTest
|
|||||||
/// 普通用户表
|
/// 普通用户表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class SYS_USER
|
public class UnitSYS_USER
|
||||||
{
|
{
|
||||||
private System.Int64? _USER_ID;
|
private System.Int64? _USER_ID;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user