mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
Add demo
This commit is contained in:
@@ -23,10 +23,22 @@ namespace OrmTest
|
||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||
db = NewUnitTest.Db;
|
||||
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
|
||||
{
|
||||
SqliteCodeFirstEnableDefaultValue = true,
|
||||
};
|
||||
db.CodeFirst.InitTables<CodeFirstUnitafa>();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
|
||||
public class CodeFirstUnitafa
|
||||
{
|
||||
[SugarColumn(DefaultValue = "(strftime('%Y-%m-%d %H:%M:%S', 'now', 'localtime'))")]
|
||||
public DateTime Name { get; set; }
|
||||
[SugarColumn(DefaultValue = "1")]
|
||||
public string Name2 { get; set; }
|
||||
}
|
||||
public class CodeFirstTable1
|
||||
{
|
||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||
|
Reference in New Issue
Block a user