|
|
@ -265,7 +265,8 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null"); |
|
|
|
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
|
return this.Insertable(insertObject); |
|
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
|
|
return this.Insertable(insertObject).InsertColumns(it => columns.Any(c => it.Equals(c,StringComparison.CurrentCultureIgnoreCase))); ; |
|
|
|
} |
|
|
|
public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new() |
|
|
|
{ |
|
|
@ -275,8 +276,9 @@ namespace SqlSugar |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(insertDynamicObject)); |
|
|
|
return this.Insertable(insertObject); |
|
|
|
var columns= ((object)insertDynamicObject).GetType().GetProperties().Select(it => it.Name).ToList(); |
|
|
|
T insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(insertDynamicObject)); |
|
|
|
return this.Insertable(insertObject).InsertColumns(it=> columns.Any(c=>it.Equals(c,StringComparison.CurrentCultureIgnoreCase))); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
@ -338,7 +340,8 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null"); |
|
|
|
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
|
return this.Updateable(updateObject); |
|
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
|
|
return this.Updateable(updateObject).UpdateColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase))); ; |
|
|
|
} |
|
|
|
public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new() |
|
|
|
{ |
|
|
@ -348,8 +351,9 @@ namespace SqlSugar |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(updateDynamicObject)); |
|
|
|
return this.Updateable(updateObject); |
|
|
|
var columns = ((object)updateDynamicObject).GetType().GetProperties().Select(it => it.Name).ToList(); |
|
|
|
T updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(updateDynamicObject)); |
|
|
|
return this.Updateable(updateObject).UpdateColumns(it => columns.Any(c => it.Equals(c, StringComparison.CurrentCultureIgnoreCase))); ; |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|