mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Synchronization code
This commit is contained in:
parent
72dc71716d
commit
0a97544267
@ -398,7 +398,7 @@ namespace SqlSugar
|
||||
}
|
||||
public IUpdateable<T> SetColumns(Expression<Func<T, object>> filedNameExpression, object fieldValue)
|
||||
{
|
||||
var name= UpdateBuilder.GetExpressionValue(filedNameExpression,ResolveExpressType.WhereSingle).GetString();
|
||||
var name= UpdateBuilder.GetExpressionValue(filedNameExpression,ResolveExpressType.FieldSingle).GetString();
|
||||
name = UpdateBuilder.Builder.GetNoTranslationColumnName(name);
|
||||
return SetColumns(name, fieldValue);
|
||||
}
|
||||
|
@ -42,12 +42,13 @@ namespace SqlSugar
|
||||
public string GetValue(Expression expression = null)
|
||||
{
|
||||
var exp = expression as MethodCallExpression;
|
||||
var entityType = (exp.Arguments[0] as LambdaExpression).Parameters[0].Type;
|
||||
if (this.Context.InitMappingInfo != null)
|
||||
{
|
||||
this.Context.InitMappingInfo(entityType);
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
//var entityType = (exp.Arguments[0] as LambdaExpression).Parameters[0].Type;
|
||||
//if (this.Context.InitMappingInfo != null)
|
||||
//{
|
||||
// this.Context.InitMappingInfo(entityType);
|
||||
// this.Context.RefreshMapping();
|
||||
//}
|
||||
InitType(exp);
|
||||
var result = "";
|
||||
if (this.Context.JoinIndex == 0)
|
||||
result = SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldSingle);
|
||||
@ -60,7 +61,17 @@ namespace SqlSugar
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void InitType(MethodCallExpression exp)
|
||||
{
|
||||
foreach (var arg in (exp.Arguments[0] as LambdaExpression).Parameters)
|
||||
{
|
||||
if (this.Context.InitMappingInfo != null)
|
||||
{
|
||||
this.Context.InitMappingInfo(arg.Type);
|
||||
this.Context.RefreshMapping();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetShortName(MethodCallExpression exp, string result)
|
||||
{
|
||||
if (exp.Arguments[0] is LambdaExpression && result.IsContainsIn("+", "-", "*", "/"))
|
||||
|
@ -413,6 +413,8 @@ namespace SqlSugar
|
||||
{
|
||||
template = template.Replace("'{2}'", "{2}");
|
||||
}
|
||||
tableName=SqlBuilder.GetTranslationTableName(tableName);
|
||||
columnName = SqlBuilder.GetTranslationTableName(columnName);
|
||||
string sql = string.Format(template, tableName, columnName, defaultValue);
|
||||
this.Context.Ado.ExecuteCommand(sql);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user