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
1438b75ae6
commit
7a48eb4820
@ -31,6 +31,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
Unitadfa12.Init();
|
||||||
Unitsdfa1231.Init();
|
Unitsdfa1231.Init();
|
||||||
Unitadfad1.Init();
|
Unitadfad1.Init();
|
||||||
UnitWeek.Init();
|
UnitWeek.Init();
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
internal class Unitadfa12
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
|
||||||
|
string tableName = "m_test";
|
||||||
|
//建表
|
||||||
|
db.CodeFirst.As<Test001>(tableName).InitTables<Test001>();
|
||||||
|
|
||||||
|
List<Test001> longList = new List<Test001>();
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
longList.Add(new Test001() { CreateTime = DateTime.Now });
|
||||||
|
}
|
||||||
|
|
||||||
|
//插入测试数据
|
||||||
|
var indexList = db.Insertable(longList).AS(tableName).ExecuteReturnPkList<long>();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//建类
|
||||||
|
public class Test001
|
||||||
|
{
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "id", ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public long Id
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "createTime", ColumnDescription = "创建时间")]
|
||||||
|
public DateTime CreateTime
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user