mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
PgSql difflog bug
This commit is contained in:
parent
859e7d34d4
commit
43d9f8caf3
@ -46,10 +46,10 @@ namespace OrmTest
|
||||
var businessData = it.BusinessData;
|
||||
var time = it.Time;
|
||||
var diffType = it.DiffType;//enum insert 、update and delete
|
||||
Console.WriteLine(businessData);
|
||||
Console.WriteLine(editBeforeData[0].Columns[1].Value);
|
||||
Console.WriteLine("to");
|
||||
Console.WriteLine(editAfterData[0].Columns[1].Value);
|
||||
//Console.WriteLine(businessData);
|
||||
//Console.WriteLine(editBeforeData[0].Columns[1].Value);
|
||||
//Console.WriteLine("to");
|
||||
//Console.WriteLine(editAfterData[0].Columns[1].Value);
|
||||
//Write logic
|
||||
};
|
||||
|
||||
@ -61,7 +61,7 @@ namespace OrmTest
|
||||
var data = db.Queryable<Order>().First();
|
||||
data.Name = "changeName";
|
||||
db.Updateable(data).EnableDiffLogEvent("--update Order--").ExecuteCommand();
|
||||
|
||||
db.Insertable(data).EnableDiffLogEvent("--inser Order--").ExecuteCommand();
|
||||
Console.WriteLine("#### Aop End ####");
|
||||
}
|
||||
}
|
||||
|
@ -747,10 +747,18 @@ namespace SqlSugar
|
||||
foreach (var item in this.EntityInfo.Columns.Where(it => it.IsIgnore == false && GetPrimaryKeys().Any(pk => pk.Equals(it.DbColumnName, StringComparison.CurrentCultureIgnoreCase))))
|
||||
{
|
||||
var fielddName = item.DbColumnName;
|
||||
var fieldValue = this.EntityInfo.Columns.FirstOrDefault(it => it.PropertyName == item.PropertyName).PropertyInfo.GetValue(this.InsertObjs.Last(), null).ObjToString();
|
||||
var filedObject = this.EntityInfo.Columns.FirstOrDefault(it => it.PropertyName == item.PropertyName).PropertyInfo.GetValue(this.InsertObjs.Last(), null);
|
||||
var fieldValue = filedObject.ObjToString();
|
||||
if (filedObject != null && filedObject.GetType() != typeof(string)&&this.Context.CurrentConnectionConfig.DbType==DbType.PostgreSQL)
|
||||
{
|
||||
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fielddName, FieldValue = fieldValue,FieldValueConvertFunc= it => UtilMethods.ChangeType2(it, filedObject.GetType()) });
|
||||
}
|
||||
else
|
||||
{
|
||||
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fielddName, FieldValue = fieldValue });
|
||||
}
|
||||
}
|
||||
}
|
||||
Check.Exception(cons.IsNullOrEmpty(), "Insertable.EnableDiffLogEvent need primary key");
|
||||
var sqlable = this.SqlBuilder.ConditionalModelToSql(cons);
|
||||
whereSql = sqlable.Key;
|
||||
|
Loading…
Reference in New Issue
Block a user