SqlSugar源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
963 B

6 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public partial class NewUnitTest
{
public static void Json()
{
Db.CodeFirst.InitTables<JsonTest>();
6 years ago
Db.DbMaintenance.TruncateTable<JsonTest>();
6 years ago
Db.Insertable(new JsonTest() { Order = new Order { Id = 1, Name = "order1" } }).ExecuteCommand();
var list = Db.Queryable<JsonTest>().ToList();
6 years ago
Db.Updateable(new JsonTest() { Id = 1, Order = new Order { Id = 2, Name = "order2" } }).ExecuteCommand();
6 years ago
var list2 = Db.Queryable<JsonTest>().ToList();
}
}
public class JsonTest
{
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
[SqlSugar.SugarColumn(ColumnDataType = "varchar(max)", IsJson = true)]
public Order Order { get; set; }
}
}