mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-26 02:39:14 +08:00
Add CSharpTypeName to ConditionalModel
This commit is contained in:
@@ -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" />
|
||||
|
||||
18
Src/Asp.Net/SqlServerTest/UnitTest/Models/Order.cs
Normal file
18
Src/Asp.Net/SqlServerTest/UnitTest/Models/Order.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user