mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Add unit test
This commit is contained in:
parent
bd734251d4
commit
581d8954c3
@ -99,6 +99,7 @@
|
|||||||
<Compile Include="Models\ViewOrder.cs" />
|
<Compile Include="Models\ViewOrder.cs" />
|
||||||
<Compile Include="UnitTest\UinitCustomConvert.cs" />
|
<Compile Include="UnitTest\UinitCustomConvert.cs" />
|
||||||
<Compile Include="UnitTest\UInsert3.cs" />
|
<Compile Include="UnitTest\UInsert3.cs" />
|
||||||
|
<Compile Include="UnitTest\UJson2.cs" />
|
||||||
<Compile Include="UnitTest\Unitadfa1231.cs" />
|
<Compile Include="UnitTest\Unitadfa1231.cs" />
|
||||||
<Compile Include="UnitTest\UnitFilterasdfas.cs" />
|
<Compile Include="UnitTest\UnitFilterasdfas.cs" />
|
||||||
<Compile Include="UnitTest\UnitSqlFunc.cs" />
|
<Compile Include="UnitTest\UnitSqlFunc.cs" />
|
||||||
|
50
Src/Asp.Net/SqlServerTest/UnitTest/UJson2.cs
Normal file
50
Src/Asp.Net/SqlServerTest/UnitTest/UJson2.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Principal;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OrmTest.UnitTest
|
||||||
|
{
|
||||||
|
internal class UJson2
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = new SqlSugarClient(new ConnectionConfig()
|
||||||
|
{
|
||||||
|
ConnectionString = Config.ConnectionString,
|
||||||
|
DbType = SqlSugar.DbType.SqlServer,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
InitKeyType = InitKeyType.Attribute,
|
||||||
|
});
|
||||||
|
db.CodeFirst.InitTables<Tb1>();
|
||||||
|
|
||||||
|
var tb = new Tb1()
|
||||||
|
{
|
||||||
|
Title = "标题这里中文正常",
|
||||||
|
JsonData = new JsonClass() { text = "这里中文乱码" }
|
||||||
|
};
|
||||||
|
db.Insertable(tb).ExecuteCommand();
|
||||||
|
Console.WriteLine(db.Insertable(tb).ToSqlString());
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
public class Tb1
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnDataType = "Nvarchar(255)")]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnDataType = "Nvarchar(255)", IsJson = true)]
|
||||||
|
public JsonClass JsonData { get; set; }
|
||||||
|
}
|
||||||
|
public class JsonClass
|
||||||
|
{
|
||||||
|
public string text { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user