mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add demo
This commit is contained in:
parent
f38f9b7d3b
commit
2927ba8e37
@ -1,6 +1,7 @@
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ namespace OrmTest
|
|||||||
InitKeyType = InitKeyType.Attribute,
|
InitKeyType = InitKeyType.Attribute,
|
||||||
IsAutoCloseConnection = true
|
IsAutoCloseConnection = true
|
||||||
});
|
});
|
||||||
|
db.CodeFirst.InitTables<CodeFirstafda1>();
|
||||||
|
db.CodeFirst.InitTables<CODEFIRSTAFDA1>();
|
||||||
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();
|
||||||
@ -77,6 +80,18 @@ namespace OrmTest
|
|||||||
Console.WriteLine("#### CodeFirst end ####");
|
Console.WriteLine("#### CodeFirst end ####");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class CodeFirstafda1
|
||||||
|
{
|
||||||
|
[SugarColumn(ColumnDataType="number")]
|
||||||
|
public int id { get; set; }
|
||||||
|
[SugarColumn(ColumnDataType = "number")]
|
||||||
|
public long id2 { get; set; }
|
||||||
|
}
|
||||||
|
public class CODEFIRSTAFDA1
|
||||||
|
{
|
||||||
|
public int id { get; set; }
|
||||||
|
public long id2 { get; set; }
|
||||||
|
}
|
||||||
public class CodeFIrstadfa
|
public class CodeFIrstadfa
|
||||||
{
|
{
|
||||||
[SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
|
[SugarColumn(IsIdentity =true,IsPrimaryKey =true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user