mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add unit test
This commit is contained in:
parent
3cb759574e
commit
4f26c471a6
@ -1,4 +1,5 @@
|
||||
using SqlSugar;
|
||||
using SqlSugar.DbConvert;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -19,13 +20,26 @@ namespace OrmTest
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
IsAutoCloseConnection = true
|
||||
});
|
||||
db.Aop.OnLogExecuting = (s, p) => Console.WriteLine(UtilMethods.GetNativeSql(s,p));
|
||||
db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1
|
||||
db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand();
|
||||
var list = db.Queryable<CodeFirstTable1>().ToList();
|
||||
db.CodeFirst.InitTables<CodeFirstTable22>();
|
||||
db.Updateable(new List<CodeFirstTable22>() { new CodeFirstTable22() { Name = "a" } })
|
||||
.ExecuteCommand();
|
||||
db.Insertable(new List<CodeFirstTable22>() { new CodeFirstTable22() { Name = "a" }, new CodeFirstTable22() { Name = "a" } })
|
||||
.ExecuteCommand();
|
||||
var list2=db.Queryable<CodeFirstTable22>().ToList();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
|
||||
public class CodeFirstTable22
|
||||
{
|
||||
[SugarColumn(OracleSequenceName = "SEQ_ID", IsPrimaryKey = true)]
|
||||
public int Id { get; set; }
|
||||
[SugarColumn(ColumnDataType ="nvarchar2",Length =200, SqlParameterDbType =typeof(Nvarchar2PropertyConvert) )]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class CodeFirstTable1
|
||||
{
|
||||
[SugarColumn(OracleSequenceName ="SEQ_ID", IsPrimaryKey = true)]
|
||||
|
Loading…
Reference in New Issue
Block a user