Add CSharpTypeName to ConditionalModel

This commit is contained in:
sunkaixuna
2022-01-09 17:55:55 +08:00
parent 306e7792b1
commit 8cfdaa987f
9 changed files with 127 additions and 3 deletions

View File

@@ -94,6 +94,7 @@
<Compile Include="Models\OrderItem.cs" />
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\Models\Order.cs" />
<Compile Include="UnitTest\Models\TestModel.cs" />
<Compile Include="UnitTest\UCustom01.cs" />
<Compile Include="UnitTest\UCustom02.cs" />

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest.UnitTest.Models
{
[SqlSugar.SugarTable("UnitMyOrder")]
public class MYOrder
{
public int Id { get; set; }
public string Name { get; set; }
[SqlSugar.SugarColumn(Length = 18, DecimalDigits = 4)]
public decimal Price { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using SqlSugar;
using OrmTest.UnitTest.Models;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -17,6 +18,27 @@ namespace OrmTest
var data = db.GetSimpleClient<Order>().GetById(id);
var x=db.Storageable(data).WhereColumns(it=>it.Price).ToStorage();
Check.Exception(x.UpdateList.Count == 0, "unit error");
db.CodeFirst.InitTables<MYOrder>();//建表
List<MYOrder> orders = new List<MYOrder>
{
new MYOrder
{
Name = "123",
Price =Convert.ToDecimal(10)
}
};
var x1 = db.Storageable(orders).WhereColumns(m => m.Price).ToStorage();
Console.WriteLine("insert:" + x1.InsertList.Count);
Console.WriteLine("update:" + x1.UpdateList.Count);
Console.WriteLine("------------");
x1.AsInsertable.ExecuteCommand();
Check.Exception( x1.AsUpdateable.ExecuteCommand()==0,"unit errors");
}
}