mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update bluecopy
This commit is contained in:
@@ -13,12 +13,12 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
Db.CodeFirst.InitTables(typeof(UnitUser));
|
Db.CodeFirst.InitTables(typeof(UnitUser));
|
||||||
Db.DbMaintenance.TruncateTable<UnitUser>();
|
Db.DbMaintenance.TruncateTable<UnitUser>();
|
||||||
Db.Insertable(new UnitUser() { 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 UnitUser() { 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 UnitUser() { USER_ID=1, PWD_LASTERRTIME = null }).WhereColumns(it=> new{ it.PWD_ERRORCOUNT, it.PWD_LASTERRTIME }).ExecuteCommand();
|
Db.Updateable(new UnitUser() { USER_ID = 1, PWD_LASTERRTIME = null }).WhereColumns(it => new { it.PWD_ERRORCOUNT, it.PWD_LASTERRTIME }).ExecuteCommand();
|
||||||
Db.CodeFirst.InitTables(typeof(UnitBoolTest));
|
Db.CodeFirst.InitTables(typeof(UnitBoolTest));
|
||||||
var x = new UnitBoolTest();
|
var x = new UnitBoolTest();
|
||||||
Db.Updateable<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { 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<UnitBoolTest>().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<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { 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<UnitBoolTest>().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<UnitBoolTest>().SetColumns(it => new UnitBoolTest() { 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();
|
||||||
@@ -26,7 +26,7 @@ namespace OrmTest
|
|||||||
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == it.BoolValue).ExecuteCommand();
|
||||||
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == true).ExecuteCommand();
|
||||||
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).ReSetValue(it => it.BoolValue == !it.BoolValue).ExecuteCommand();
|
||||||
Db.Updateable<UnitBoolTest>(x).UpdateColumns(it =>new { it.BoolValue }) .ExecuteCommand();
|
Db.Updateable<UnitBoolTest>(x).UpdateColumns(it => new { it.BoolValue }).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ namespace OrmTest
|
|||||||
|
|
||||||
sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary()
|
sql = Db.Updateable<UnitDiary>().SetColumns(it => new UnitDiary()
|
||||||
{
|
{
|
||||||
TypeID = saveDiary.TypeID,
|
TypeID = saveDiary.TypeID,
|
||||||
}).Where(it => it.ID == saveDiary.ID).ToSql();
|
}).Where(it => it.ID == saveDiary.ID).ToSql();
|
||||||
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
||||||
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
||||||
@@ -62,7 +62,7 @@ namespace OrmTest
|
|||||||
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
UValidate.Check(sql.Key, @"UPDATE [Diary] SET
|
||||||
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
[TypeID] = @Const0 WHERE ( [ID] = @ID1 )", "Updateable");
|
||||||
|
|
||||||
sql=Db.Updateable<NullTest>().SetColumns(it => new NullTest()
|
sql = Db.Updateable<NullTest>().SetColumns(it => new NullTest()
|
||||||
{
|
{
|
||||||
p = true
|
p = true
|
||||||
|
|
||||||
@@ -81,20 +81,31 @@ namespace OrmTest
|
|||||||
Db.Updateable<Order>()
|
Db.Updateable<Order>()
|
||||||
.SetColumns(it => it.Name == "a")
|
.SetColumns(it => it.Name == "a")
|
||||||
.SetColumns(it => it.CreateTime == DateTime.Now)
|
.SetColumns(it => it.CreateTime == DateTime.Now)
|
||||||
.SetColumns(it=>it.Price==1).Where(it=>it.Id==1).ExecuteCommand();
|
.SetColumns(it => it.Price == 1).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
Db.Updateable<Order>()
|
Db.Updateable<Order>()
|
||||||
.SetColumns(it =>new Order{ Name="a",CreateTime=DateTime.Now })
|
.SetColumns(it => new Order { Name = "a", CreateTime = DateTime.Now })
|
||||||
.SetColumns(it => it.Price==1).Where(it => it.Id == 1).ExecuteCommand();
|
.SetColumns(it => it.Price == 1).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Db.Updateable<Order>()
|
Db.Updateable<Order>()
|
||||||
.SetColumns(it => new Order { Name = "a", CreateTime = DateTime.Now })
|
.SetColumns(it => new Order { Name = "a", CreateTime = DateTime.Now })
|
||||||
.SetColumns(it => new Order() { Price=1 }).Where(it => it.Id == 1).ExecuteCommand();
|
.SetColumns(it => new Order() { Price = 1 }).Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
|
Db.CodeFirst.InitTables<Unitbluecopy>();
|
||||||
|
Db.Insertable(new Unitbluecopy()).UseSqlServer().ExecuteBlueCopy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Unitbluecopy
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
[SugarColumn(IsNullable =true)]
|
||||||
|
public decimal? x { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class NullTest
|
public class NullTest
|
||||||
{
|
{
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
|
@@ -81,6 +81,10 @@ namespace SqlSugar
|
|||||||
value.Value = Convert.ToDateTime("1753/01/01");
|
value.Value = Convert.ToDateTime("1753/01/01");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (value.Value == null)
|
||||||
|
{
|
||||||
|
value.Value = DBNull.Value;
|
||||||
|
}
|
||||||
dr[item.ColumnName] = value.Value;
|
dr[item.ColumnName] = value.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user