mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-01 10:10:16 +08:00
Update diff log
This commit is contained in:
parent
a0d24f608b
commit
a10e2a7ef5
@ -117,15 +117,25 @@ namespace SqlSugar
|
||||
{
|
||||
UpdateBuilder.Parameters = UpdateBuilder.Parameters.Where(it => UtilMethods.NoErrorParameter(it.ParameterName)).ToList();
|
||||
}
|
||||
List<SugarParameter> oldParas = null;
|
||||
if (IsEnableDiffLogEvent)
|
||||
{
|
||||
oldParas=UtilMethods.CopySugarParameters(UpdateBuilder.Parameters);
|
||||
}
|
||||
if (sql != Environment.NewLine)
|
||||
{
|
||||
result = this.Ado.ExecuteCommand(sql, UpdateBuilder.Parameters == null ? null : UpdateBuilder.Parameters.ToArray());
|
||||
}
|
||||
if (oldParas != null&& UpdateBuilder.Parameters!=null)
|
||||
{
|
||||
if (string.Join(",", oldParas.Select(it => it.ParameterName)) != string.Join(",", UpdateBuilder.Parameters.Select(it => it.ParameterName)))
|
||||
{
|
||||
UpdateBuilder.Parameters = oldParas;
|
||||
}
|
||||
}
|
||||
After(sql);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public bool ExecuteCommandHasChange()
|
||||
{
|
||||
return this.ExecuteCommand() > 0;
|
||||
|
@ -18,6 +18,37 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
|
||||
public static List<SugarParameter> CopySugarParameters(List<SugarParameter> pars)
|
||||
{
|
||||
if(pars==null) return null;
|
||||
var newParameters = pars.Select(it => new SugarParameter(it.ParameterName, it.Value)
|
||||
{
|
||||
TypeName = it.TypeName,
|
||||
Value = it.Value,
|
||||
IsRefCursor = it.IsRefCursor,
|
||||
IsArray = it.IsArray,
|
||||
IsJson = it.IsJson,
|
||||
ParameterName = it.ParameterName,
|
||||
IsNvarchar2 = it.IsNvarchar2,
|
||||
IsNClob = it.IsClob,
|
||||
IsClob = it.IsClob,
|
||||
UdtTypeName = it.UdtTypeName,
|
||||
CustomDbType = it.CustomDbType,
|
||||
DbType = it.DbType,
|
||||
Direction = it.Direction,
|
||||
Precision = it.Precision,
|
||||
Size = it.Size,
|
||||
Scale = it.Scale,
|
||||
IsNullable = it.IsNullable,
|
||||
SourceColumn = it.SourceColumn,
|
||||
SourceColumnNullMapping = it.SourceColumnNullMapping,
|
||||
SourceVersion = it.SourceVersion,
|
||||
TempDate = it.TempDate,
|
||||
_Size = it._Size
|
||||
});
|
||||
return newParameters.ToList();
|
||||
}
|
||||
public static bool IsTuple(Type tType, List<PropertyInfo> classProperties)
|
||||
{
|
||||
if (classProperties?.Any() != true)
|
||||
|
Loading…
Reference in New Issue
Block a user