diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs index 73af85dd9..631cfebfb 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs @@ -287,6 +287,14 @@ namespace SqlSugar { return columnInfo.InsertSql; } + else if (columnInfo.SqlParameterDbType is Type && (Type)columnInfo.SqlParameterDbType == UtilConstants.SqlConvertType) + { + var type = columnInfo.SqlParameterDbType as Type; + var ParameterConverter = type.GetMethod("ParameterConverter").MakeGenericMethod(typeof(string)); + var obj = Activator.CreateInstance(type); + var p = ParameterConverter.Invoke(obj, new object[] { columnInfo.Value, GetDbColumnIndex }) as SugarParameter; + return p.ParameterName; + } else if (columnInfo.SqlParameterDbType is Type) { var type=columnInfo.SqlParameterDbType as Type; diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs index 19ec844a1..f845f5397 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/UpdateBuilder.cs @@ -402,7 +402,15 @@ namespace SqlSugar { return columnInfo.UpdateSql; } - else if (columnInfo.SqlParameterDbType is Type) + else if (columnInfo.SqlParameterDbType is Type&& (Type)columnInfo.SqlParameterDbType == UtilConstants.SqlConvertType) + { + var type = columnInfo.SqlParameterDbType as Type; + var ParameterConverter = type.GetMethod("ParameterConverter").MakeGenericMethod(typeof(string)); + var obj = Activator.CreateInstance(type); + var p = ParameterConverter.Invoke(obj, new object[] { columnInfo.Value, GetDbColumnIndex }) as SugarParameter; + return p.ParameterName; + } + else if (columnInfo.SqlParameterDbType is Type) { var type = columnInfo.SqlParameterDbType as Type; var ParameterConverter = type.GetMethod("ParameterConverter").MakeGenericMethod(columnInfo.PropertyType); diff --git a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs index f4c78380b..0bf0b5033 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/UpdateProvider/UpdateableProvider.cs @@ -531,6 +531,20 @@ namespace SqlSugar return this; } } + public IUpdateable SetColumns(Expression> filedNameExpression, Expression> valueExpression) + { + var name = UpdateBuilder.GetExpressionValue(filedNameExpression, ResolveExpressType.FieldSingle).GetString(); + name = UpdateBuilder.Builder.GetNoTranslationColumnName(name); + var value = UpdateBuilder.GetExpressionValue(valueExpression, ResolveExpressType.FieldSingle).GetString(); + this.UpdateBuilder.DbColumnInfoList.Add(new DbColumnInfo() + { + DbColumnName = name, + Value = value, + PropertyName = name , + SqlParameterDbType=typeof(SqlSugar.DbConvert.No