Savesble support DiffLog

This commit is contained in:
sunkaixuan
2019-03-17 14:50:11 +08:00
parent 7d0326cafd
commit 4f00c13883
3 changed files with 19 additions and 0 deletions

View File

@@ -84,6 +84,10 @@ namespace OrmTest.Demo
db.Insertable(new DataTestInfo2() { Bool1=true, Bool2=false, PK=Guid.NewGuid(), Text1="a" })
.EnableDiffLogEvent(new { title = "add DataTestInfo2" })
.ExecuteReturnIdentity();
db.Saveable(new Student() {Name="saveinsert"}).EnableDiffLogEvent().ExecuteCommand();
db.Saveable(new Student() { Id=id, Name = "saveinsert" }).EnableDiffLogEvent().ExecuteCommand();
}
}
}

View File

@@ -120,6 +120,20 @@ namespace SqlSugar
return this;
}
public ISaveable<T> EnableDiffLogEvent(object businessData = null)
{
LoadInsertable();
if (this.insertable != null)
{
this.insertable.EnableDiffLogEvent(businessData);
}
if (this.updateable != null)
{
this.updateable.EnableDiffLogEvent(businessData);
}
return this;
}
public ISaveable<T> InsertIgnoreColumns(Expression<Func<T, object>> columns)
{
LoadInsertable();

View File

@@ -15,5 +15,6 @@ namespace SqlSugar
ISaveable<T> InsertIgnoreColumns(Expression<Func<T, object>> columns);
ISaveable<T> UpdateColumns(Expression<Func<T, object>> columns);
ISaveable<T> UpdateIgnoreColumns(Expression<Func<T, object>> columns);
ISaveable<T> EnableDiffLogEvent(object businessData = null);
}
}