update demo

This commit is contained in:
sunkaixuan 2023-04-21 21:17:11 +08:00
parent 3ea4977b8c
commit a891cf00fc

View File

@ -21,6 +21,7 @@ namespace OrmTest
IsAutoCloseConnection = true
});
db.DbMaintenance.CreateDatabase();
db.Aop.OnLogExecuting = (s, p) =>Console.WriteLine( UtilMethods.GetNativeSql(s, p));
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
var list = db.Queryable<CodeFirstTable1>().ToList();
@ -138,7 +139,7 @@ namespace OrmTest
public string Name { get; set; }
[SugarColumn(ColumnDataType = "varchar(255)")]//custom
public string Text { get; set; }
[SugarColumn(IsNullable = true)]
[SugarColumn(IsNullable = true,DefaultValue = "current_timestamp")]
public DateTime CreateTime { get; set; }
}
}