|
|
@ -316,7 +316,7 @@ namespace SqlSugar |
|
|
|
public IUpdateable<T> SetColumns(Expression<Func<T, bool>> columns) |
|
|
|
{ |
|
|
|
ThrowUpdateByObject(); |
|
|
|
CheckTranscodeing(); |
|
|
|
|
|
|
|
var binaryExp = columns.Body as BinaryExpression; |
|
|
|
Check.Exception(!binaryExp.NodeType.IsIn(ExpressionType.Equal), "No support {0}", columns.ToString()); |
|
|
|
Check.Exception(!(binaryExp.Left is MemberExpression) && !(binaryExp.Left is UnaryExpression), "No support {0}", columns.ToString()); |
|
|
@ -327,6 +327,12 @@ namespace SqlSugar |
|
|
|
expResult = Regex.Split(expResult, " IS NULL ")[0]+" = NULL "; |
|
|
|
} |
|
|
|
string key = SqlBuilder.GetNoTranslationColumnName(expResult); |
|
|
|
|
|
|
|
if (EntityInfo.Columns.Where(it=>it.IsJson||it.IsTranscoding).Any(it => it.DbColumnName.EqualCase(key) || it.PropertyName.EqualCase(key))) |
|
|
|
{ |
|
|
|
CheckTranscodeing(); |
|
|
|
} |
|
|
|
|
|
|
|
UpdateBuilder.SetValues.Add(new KeyValuePair<string, string>(SqlBuilder.GetTranslationColumnName(key), expResult)); |
|
|
|
this.UpdateBuilder.DbColumnInfoList = this.UpdateBuilder.DbColumnInfoList.Where(it => (UpdateParameterIsNull == false && IsPrimaryKey(it)) || UpdateBuilder.SetValues.Any(v => SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.DbColumnName, StringComparison.CurrentCultureIgnoreCase) || SqlBuilder.GetNoTranslationColumnName(v.Key).Equals(it.PropertyName, StringComparison.CurrentCultureIgnoreCase)) || it.IsPrimarykey == true).ToList(); |
|
|
|
AppendSets(); |
|
|
|