Update diff log bug

This commit is contained in:
sunkaixuan 2022-05-03 15:36:55 +08:00
parent 01950b556c
commit 6378850d80
4 changed files with 23 additions and 0 deletions

View File

@ -59,6 +59,9 @@ namespace OrmTest
db.Insertable(list.Take(5).ToList()).EnableDiffLogEvent().ExecuteCommand();
db.CodeFirst.InitTables<DiffLong>();
db.Insertable(new List<DiffLong>() { new DiffLong() { Id=SnowFlakeSingle.Instance.NextId(), Name="2" },new DiffLong() { Id = SnowFlakeSingle.Instance.NextId(), Name = "2" } }).EnableDiffLogEvent().ExecuteCommand();
db.Insertable(new Order() { CreateTime=DateTime.Now, CustomId=1, Name="a" ,Price=1 }).EnableDiffLogEvent().ExecuteCommand();
data.Name = "changeName";

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class DiffLong
{
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
public long Id { get; set; }
public string Name { get; set; }
}
}

View File

@ -85,6 +85,7 @@
<Compile Include="Demo\DemoN_SplitTable.cs" />
<Compile Include="Models\DataDictionary.cs" />
<Compile Include="Models\Custom.cs" />
<Compile Include="Models\DiffLong.cs" />
<Compile Include="Models\EntityMapper.cs" />
<Compile Include="Models\Mapper.cs" />
<Compile Include="Models\SubInsertTest.cs" />

View File

@ -861,6 +861,10 @@ namespace SqlSugar
{
return GetDiffTableByEntity();
}
else if (GetIdentityKeys().IsNullOrEmpty())
{
return GetDiffTableByEntity();
}
else
{
return GetDiffTableBySql(identity);