mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Synchronization code
This commit is contained in:
parent
c78014542c
commit
5c770dc03f
@ -23,34 +23,35 @@ namespace SqlSugar
|
|||||||
AppendOnlyInSelectConvertToString(parameter, item, asName);
|
AppendOnlyInSelectConvertToString(parameter, item, asName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ExpressionTool.GetMethodName(item) == "ToString"
|
else if (ExpressionTool.GetMethodName(item) == "ToString"
|
||||||
&&(item as MethodCallExpression)?.Arguments?.Count()==1
|
&& (item as MethodCallExpression)?.Arguments?.Count() == 1
|
||||||
&& (item as MethodCallExpression)?.Object?.Type!=UtilConstants.DateType
|
&& (item as MethodCallExpression)?.Object?.Type != UtilConstants.DateType
|
||||||
&& this.Context?.SugarContext?.QueryBuilder!=null
|
&& this.Context?.SugarContext?.QueryBuilder != null
|
||||||
&& (item as MethodCallExpression)?.Method?.ReflectedType?.Name!="SqlFunc"
|
&& (item as MethodCallExpression)?.Method?.ReflectedType?.Name != "SqlFunc"
|
||||||
&& (item as MethodCallExpression)?.Method?.ReflectedType?.Name != "Convert"
|
&& (item as MethodCallExpression)?.Method?.ReflectedType?.Name != "Convert"
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var format=ExpressionTool.GetExpressionValue((item as MethodCallExpression)?.Arguments[0]);
|
var format = ExpressionTool.GetExpressionValue((item as MethodCallExpression)?.Arguments[0]);
|
||||||
var childExpression = (item as MethodCallExpression)?.Object;
|
var childExpression = (item as MethodCallExpression)?.Object;
|
||||||
var type=childExpression.Type;
|
var type = childExpression.Type;
|
||||||
if (this.Context.SugarContext.QueryBuilder.QueryableFormats == null)
|
if (this.Context.SugarContext.QueryBuilder.QueryableFormats == null)
|
||||||
{
|
{
|
||||||
this.Context.SugarContext.QueryBuilder.QueryableFormats = new List<QueryableFormat>();
|
this.Context.SugarContext.QueryBuilder.QueryableFormats = new List<QueryableFormat>();
|
||||||
}
|
}
|
||||||
this.Context.SugarContext.QueryBuilder.QueryableFormats.Add(new QueryableFormat() {
|
this.Context.SugarContext.QueryBuilder.QueryableFormats.Add(new QueryableFormat()
|
||||||
Format=format+"",
|
{
|
||||||
PropertyName=asName,
|
Format = format + "",
|
||||||
Type=type,
|
PropertyName = asName,
|
||||||
TypeString=type.FullName,
|
Type = type,
|
||||||
MethodName= "ToString"
|
TypeString = type.FullName,
|
||||||
|
MethodName = "ToString"
|
||||||
});
|
});
|
||||||
parameter.Context.Result.Append(this.Context.GetAsString2(asName, GetNewExpressionValue(childExpression)));
|
parameter.Context.Result.Append(this.Context.GetAsString2(asName, GetNewExpressionValue(childExpression)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ExpressionTool.GetMethodName(item) == "ToString"
|
else if (ExpressionTool.GetMethodName(item) == "ToString"
|
||||||
&& (item as MethodCallExpression)?.Arguments?.Count() == 0
|
&& (item as MethodCallExpression)?.Arguments?.Count() == 0
|
||||||
&& (item as MethodCallExpression)?.Object?.Type?.IsEnum==true
|
&& (item as MethodCallExpression)?.Object?.Type?.IsEnum == true
|
||||||
&& this.Context?.SugarContext?.QueryBuilder != null)
|
&& this.Context?.SugarContext?.QueryBuilder != null)
|
||||||
{
|
{
|
||||||
var childExpression = (item as MethodCallExpression)?.Object;
|
var childExpression = (item as MethodCallExpression)?.Object;
|
||||||
@ -60,7 +61,7 @@ namespace SqlSugar
|
|||||||
this.Context.SugarContext.QueryBuilder.QueryableFormats = new List<QueryableFormat>();
|
this.Context.SugarContext.QueryBuilder.QueryableFormats = new List<QueryableFormat>();
|
||||||
}
|
}
|
||||||
this.Context.SugarContext.QueryBuilder.QueryableFormats.Add(new QueryableFormat()
|
this.Context.SugarContext.QueryBuilder.QueryableFormats.Add(new QueryableFormat()
|
||||||
{
|
{
|
||||||
PropertyName = asName,
|
PropertyName = asName,
|
||||||
Type = type,
|
Type = type,
|
||||||
TypeString = "Enum",
|
TypeString = "Enum",
|
||||||
@ -83,6 +84,12 @@ namespace SqlSugar
|
|||||||
this.Context.SingleTableNameSubqueryShortName = ps.FirstOrDefault().Name;
|
this.Context.SingleTableNameSubqueryShortName = ps.FirstOrDefault().Name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (item is MethodCallExpression&&ExpressionTool.IsVariable(item))
|
||||||
|
{
|
||||||
|
var p = GetNewExpressionValue(item);
|
||||||
|
parameter.Context.Result.Append(this.Context.GetAsString2(asName, p));
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.Expression = item;
|
this.Expression = item;
|
||||||
var negateString = string.Empty;
|
var negateString = string.Empty;
|
||||||
if (item.NodeType == ExpressionType.Negate)
|
if (item.NodeType == ExpressionType.Negate)
|
||||||
|
Loading…
Reference in New Issue
Block a user