mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add demo
This commit is contained in:
parent
18a375be05
commit
e4a9a88259
@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static OrmTest.DemoE_CodeFirst;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
@ -23,6 +24,7 @@ namespace OrmTest
|
||||
{
|
||||
Console.WriteLine(s);
|
||||
};
|
||||
db.CodeFirst.InitTables<QuestdbTestData3>();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text = "a" }).ExecuteCommand();
|
||||
@ -33,6 +35,32 @@ namespace OrmTest
|
||||
TestGuid(db);
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
[SugarTable("QuestdbTestData3")]
|
||||
|
||||
public class QuestdbTestData3
|
||||
|
||||
{
|
||||
|
||||
//不支持自增和主键 (标识主键是用来更新用的)
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
|
||||
public string Id { get; set; }
|
||||
[SugarColumn(IsJson = true)]
|
||||
|
||||
public List<QuestdbTestData> Data { get; set; }
|
||||
|
||||
|
||||
|
||||
[TimeDbSplitField(DateType.Year)]
|
||||
|
||||
public DateTime Time1 { get; set; }
|
||||
|
||||
}
|
||||
public class QuestdbTestData
|
||||
{
|
||||
public int xx { get; set; }
|
||||
}
|
||||
private static void TestGuid(SqlSugarClient db)
|
||||
{
|
||||
db.CodeFirst.InitTables<GuidTest>();
|
||||
|
Loading…
Reference in New Issue
Block a user