mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add demo
This commit is contained in:
parent
585bd372d5
commit
cd3a2eb097
@ -19,14 +19,21 @@ namespace OrmTest
|
|||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
});
|
});
|
||||||
db.DbMaintenance.CreateDatabase();
|
//db.DbMaintenance.CreateDatabase();
|
||||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
||||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||||
|
db.CodeFirst.InitTables<DateTimeTest2>();
|
||||||
|
db.Insertable(new DateTimeTest2() { }).ExecuteCommand();
|
||||||
Console.WriteLine("#### CodeFirst end ####");
|
Console.WriteLine("#### CodeFirst end ####");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DateTimeTest2
|
||||||
|
{
|
||||||
|
[SugarColumn(IsNullable =true)]
|
||||||
|
public DateTime? dt { get; set; }
|
||||||
|
}
|
||||||
public class CodeFirstTable1
|
public class CodeFirstTable1
|
||||||
{
|
{
|
||||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||||
|
@ -11,6 +11,7 @@ namespace OrmTest
|
|||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
DemoE_CodeFirst.Init();
|
||||||
Demo0_SqlSugarClient.Init();
|
Demo0_SqlSugarClient.Init();
|
||||||
Demo1_Queryable.Init();
|
Demo1_Queryable.Init();
|
||||||
Demo2_Updateable.Init();
|
Demo2_Updateable.Init();
|
||||||
|
Loading…
Reference in New Issue
Block a user