|
@ -22,8 +22,46 @@ namespace OrmTest |
|
|
}).ExecuteCommand(); |
|
|
}).ExecuteCommand(); |
|
|
|
|
|
|
|
|
db.Insertable(new ORDER() { Name = "a" }).ExecuteCommand(); |
|
|
db.Insertable(new ORDER() { Name = "a" }).ExecuteCommand(); |
|
|
} |
|
|
db.Updateable(new Order() |
|
|
|
|
|
{ |
|
|
|
|
|
CustomId = 1, |
|
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
|
Id = 1, |
|
|
|
|
|
Price = 1, |
|
|
|
|
|
Name = "a" |
|
|
|
|
|
}).ExecuteCommand(); |
|
|
|
|
|
db.Updateable(new List<Order>(){ new Order() |
|
|
|
|
|
{ |
|
|
|
|
|
CustomId = 1, |
|
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
|
Id = 1, |
|
|
|
|
|
Price = 1, |
|
|
|
|
|
Name = "a" |
|
|
|
|
|
}, |
|
|
|
|
|
new Order() |
|
|
|
|
|
{ |
|
|
|
|
|
CustomId = 1, |
|
|
|
|
|
CreateTime = DateTime.Now, |
|
|
|
|
|
Id = 1, |
|
|
|
|
|
Price = 1, |
|
|
|
|
|
Name = "a" |
|
|
|
|
|
} }).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.Updateable<Order>().SetColumns(it => new Order() |
|
|
|
|
|
{ |
|
|
|
|
|
CustomId = 1, |
|
|
|
|
|
Price = 1, |
|
|
|
|
|
Name = "a" |
|
|
|
|
|
}, true).Where(it => it.Id == 1).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
db.Updateable<ORDER>().SetColumns(it => new ORDER() |
|
|
|
|
|
{ |
|
|
|
|
|
CustomId = 1, |
|
|
|
|
|
Price = 1, |
|
|
|
|
|
Name = "a" |
|
|
|
|
|
}, true).Where(it => it.Id == 1).ExecuteCommand(); |
|
|
|
|
|
} |
|
|
public class Order |
|
|
public class Order |
|
|
{ |
|
|
{ |
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
|
@ -33,7 +71,7 @@ namespace OrmTest |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public string Name { get; set; } |
|
|
public string Name { get; set; } |
|
|
public decimal Price { get; set; } |
|
|
public decimal Price { get; set; } |
|
|
[SugarColumn(InsertServerTime =true)] |
|
|
[SugarColumn(InsertServerTime =true,UpdateServerTime =true)] |
|
|
public DateTime CreateTime { get; set; } |
|
|
public DateTime CreateTime { get; set; } |
|
|
[SugarColumn(IsNullable = true)] |
|
|
[SugarColumn(IsNullable = true)] |
|
|
public int CustomId { get; set; } |
|
|
public int CustomId { get; set; } |
|
@ -48,7 +86,7 @@ namespace OrmTest |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public string Name { get; set; } |
|
|
public string Name { get; set; } |
|
|
public decimal Price { get; set; } |
|
|
public decimal Price { get; set; } |
|
|
[SugarColumn(InsertSql = "'2020-1-1'")] |
|
|
[SugarColumn(InsertSql = "'2020-1-1'",UpdateSql = "'2022-1-1'")] |
|
|
public DateTime CreateTime { get; set; } |
|
|
public DateTime CreateTime { get; set; } |
|
|
[SugarColumn(IsNullable = true)] |
|
|
[SugarColumn(IsNullable = true)] |
|
|
public int CustomId { get; set; } |
|
|
public int CustomId { get; set; } |
|
|