mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-26 22:25:49 +08:00
Add demo
This commit is contained in:
@@ -20,6 +20,15 @@ namespace OrmTest
|
||||
IsAutoCloseConnection = true
|
||||
});
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
db.CodeFirst.InitTables<CodeFirstunitea>();
|
||||
db.Insertable(new CodeFirstunitea()
|
||||
{
|
||||
id2 = null
|
||||
}).ExecuteCommand();
|
||||
db.Insertable(new CodeFirstunitea()
|
||||
{
|
||||
id2 = 1
|
||||
}).ExecuteCommand();
|
||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||
@@ -35,6 +44,13 @@ namespace OrmTest
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
public class CodeFirstunitea
|
||||
{
|
||||
[SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
|
||||
public uint id { get; set; }
|
||||
[SugarColumn(IsNullable =true)]
|
||||
public uint? id2 { get; set; }
|
||||
}
|
||||
public class CodeFirstsaf
|
||||
{
|
||||
[SugarColumn(DefaultValue ="")]
|
||||
|
||||
Reference in New Issue
Block a user