mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-06-28 13:34:32 +08:00
Optimize the code
This commit is contained in:
parent
4eb4165ef9
commit
48e656f60b
@ -55,6 +55,19 @@ namespace SqlSugar
|
|||||||
|
|
||||||
protected void ResolveNewExpressions(ExpressionParameter parameter, Expression item, string asName)
|
protected void ResolveNewExpressions(ExpressionParameter parameter, Expression item, string asName)
|
||||||
{
|
{
|
||||||
|
if (item is ParameterExpression)
|
||||||
|
{
|
||||||
|
var itemType = item.Type;
|
||||||
|
var ignoreProperty = itemType.GetProperties().FirstOrDefault(it => it.PropertyType == itemType);
|
||||||
|
if (ignoreProperty != null && ignoreProperty.Name != asName)
|
||||||
|
{
|
||||||
|
if (this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns == null)
|
||||||
|
{
|
||||||
|
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns = new List<KeyValuePair<string, string>>();
|
||||||
|
}
|
||||||
|
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns.Add(new KeyValuePair<string, string>(ignoreProperty.Name, itemType.Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (item is ConstantExpression)
|
if (item is ConstantExpression)
|
||||||
{
|
{
|
||||||
ResolveConst(parameter, item, asName);
|
ResolveConst(parameter, item, asName);
|
||||||
|
@ -356,19 +356,6 @@ namespace SqlSugar
|
|||||||
item = (item as UnaryExpression).Operand;
|
item = (item as UnaryExpression).Operand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item is ParameterExpression)
|
|
||||||
{
|
|
||||||
var itemType = item.Type;
|
|
||||||
var ignoreProperty = itemType.GetProperties().FirstOrDefault(it => it.PropertyType == itemType);
|
|
||||||
if (ignoreProperty != null && ignoreProperty.Name != memberName)
|
|
||||||
{
|
|
||||||
if (this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns == null)
|
|
||||||
{
|
|
||||||
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns = new List<KeyValuePair<string, string>>();
|
|
||||||
}
|
|
||||||
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns.Add(new KeyValuePair<string, string>(ignoreProperty.Name, itemType.Name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ResolveNewExpressions(parameter, item, memberName);
|
ResolveNewExpressions(parameter, item, memberName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,19 +158,6 @@ namespace SqlSugar
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
if (item is ParameterExpression)
|
|
||||||
{
|
|
||||||
var itemType = item.Type;
|
|
||||||
var ignoreProperty = itemType.GetProperties().FirstOrDefault(it => it.PropertyType == itemType);
|
|
||||||
if (ignoreProperty!=null&& ignoreProperty.Name!=memberName)
|
|
||||||
{
|
|
||||||
if (this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns == null)
|
|
||||||
{
|
|
||||||
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns = new List<KeyValuePair<string, string>>();
|
|
||||||
}
|
|
||||||
this.Context.SugarContext.QueryBuilder.SelectNewIgnoreColumns.Add(new KeyValuePair<string, string>(ignoreProperty.Name, itemType.Name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ResolveNewExpressions(parameter, item, memberName);
|
ResolveNewExpressions(parameter, item, memberName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user