Synchronization code

This commit is contained in:
sunkaixuan 2024-06-11 22:44:38 +08:00
parent 8009e9cda1
commit c25501bdd7
2 changed files with 7 additions and 4 deletions

View File

@ -111,9 +111,9 @@ namespace SqlSugar
}
public StorageableCommonMethodInfo IgnoreColumns(params string[] ignoreColumns)
{
PropertyInfo property = ObjectValue.GetType().GetProperty(type);
var value = property.GetValue(ObjectValue);
var newObj = value.GetType().GetMyMethod("IgnoreColumns", 1, typeof(string[])).Invoke(value, new object[] { ignoreColumns });
PropertyInfo property = ObjectValue?.GetType().GetProperty(type);
var value = property?.GetValue(ObjectValue);
var newObj = value?.GetType().GetMyMethod("IgnoreColumns", 1, typeof(string[])).Invoke(value, new object[] { ignoreColumns });
StorageableCommonMethodInfo result = new StorageableCommonMethodInfo();
result.Value = newObj;
return result;
@ -124,6 +124,7 @@ namespace SqlSugar
public object Value { get; set; }
public int ExecuteCommand()
{
if(Value == null) return 0;
var newObj = Value.GetType().GetMethod("ExecuteCommand").Invoke(Value, new object[] { });
return (int)newObj;
}

View File

@ -57,7 +57,9 @@ namespace SqlSugar
var sqlTemp = ($" UPDATE {tableWithString} SET {{0}} WHERE {{1}};\r\n");
List<SugarParameter> parameters = new List<SugarParameter>();
Check.ExceptionEasy(wheres?.Any() != true, "Updates cannot be without a primary key or condition", "更新不能没有主键或者条件");
foreach (var item in this.Context.Updateable(updateObjects).UpdateBuilder.DbColumnInfoList.GroupBy(it => it.TableId))
var sqlDb = this.Context.CopyNew();
sqlDb.Aop.DataExecuting = null;
foreach (var item in sqlDb.Updateable(updateObjects).UpdateBuilder.DbColumnInfoList.GroupBy(it => it.TableId))
{
Check.ExceptionEasy(item?.ToList()?.Any() != true, "Set has no columns", "更新Set没有列");
StringBuilder setString = new StringBuilder();