Browse Source

Add unit test

pull/36/head
sunkaixuan 1 year ago
parent
commit
332fa189ac
  1. 10
      Src/Asp.NetCore2/MySqlTest/Demo/DemoE_CodeFirst.cs

10
Src/Asp.NetCore2/MySqlTest/Demo/DemoE_CodeFirst.cs

@ -1,4 +1,5 @@
using SqlSugar; using Newtonsoft.Json.Linq;
using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -29,9 +30,16 @@ namespace OrmTest
db.CodeFirst.InitTables<Charafafa2>(); db.CodeFirst.InitTables<Charafafa2>();
db.Insertable(new Charafafa2() { TimeSpanTimeSpan = TimeSpan.FromSeconds(1) }).ExecuteCommand(); db.Insertable(new Charafafa2() { TimeSpanTimeSpan = TimeSpan.FromSeconds(1) }).ExecuteCommand();
var list2=db.Queryable<Charafafa2>().ToList(); var list2=db.Queryable<Charafafa2>().ToList();
db.CodeFirst.InitTables<Codeafadfa>();
db.Insertable(new Codeafadfa() { Array = JArray.FromObject(new string[] { "a" }) }).ExecuteCommand();
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }
} }
public class Codeafadfa
{
[SugarColumn(ColumnDataType ="varchar(500)" )]
public object Array { get; set; }
}
public class Charafafa2 public class Charafafa2
{ {
public TimeSpan TimeSpanTimeSpan { get; set; } public TimeSpan TimeSpanTimeSpan { get; set; }

Loading…
Cancel
Save