sunkaixuan
2 years ago
4 changed files with 62 additions and 2 deletions
@ -0,0 +1,58 @@ |
|||
using SqlSugar; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data.SqlTypes; |
|||
using System.Linq; |
|||
using System.Security.Principal; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace OrmTest |
|||
{ |
|||
internal class UInsert3 |
|||
{ |
|||
public static void Init() |
|||
{ |
|||
var db = NewUnitTest.Db; |
|||
db.GetDate(); |
|||
db.Insertable(new Order() { Name = "a" }).ExecuteCommand(); |
|||
|
|||
db.Insertable(new List<Order>() { |
|||
new Order() { Name = "a" }, |
|||
new Order() { Name = "a" } |
|||
}).ExecuteCommand(); |
|||
|
|||
db.Insertable(new ORDER() { Name = "a" }).ExecuteCommand(); |
|||
} |
|||
|
|||
public class Order |
|||
{ |
|||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
|||
public int Id { get; set; } |
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
public decimal Price { get; set; } |
|||
[SugarColumn(InsertServerTime =true)] |
|||
public DateTime CreateTime { get; set; } |
|||
[SugarColumn(IsNullable = true)] |
|||
public int CustomId { get; set; } |
|||
} |
|||
|
|||
public class ORDER |
|||
{ |
|||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] |
|||
public int Id { get; set; } |
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
public decimal Price { get; set; } |
|||
[SugarColumn(InsertSql = "'2020-1-1'")] |
|||
public DateTime CreateTime { get; set; } |
|||
[SugarColumn(IsNullable = true)] |
|||
public int CustomId { get; set; } |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue