Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
a8344f3d4c
  1. 36
      SqlSugar/ExpressionsToSql/ResolveItems/MemberConstExpressionResolve.cs

36
SqlSugar/ExpressionsToSql/ResolveItems/MemberConstExpressionResolve.cs

@ -97,27 +97,25 @@ namespace SqlSugar
private static object GetFiledValue(MemberExpression memberExpr)
{
object reval;
object reval = null;
FieldInfo field = (FieldInfo)memberExpr.Member;
reval = field.GetValue(memberExpr.Member);
if (reval != null && reval.GetType().IsClass && reval.GetType() != ExpressionConst.StringType)
{
FieldInfo field = (FieldInfo)memberExpr.Member;
reval = field.GetValue(memberExpr.Member);
if (reval != null && reval.GetType().IsClass && reval.GetType() != ExpressionConst.StringType)
var fieldName = memberExpr.Member.Name;
var proInfo = reval.GetType().GetProperty(fieldName);
if (proInfo != null)
{
reval = proInfo.GetValue(reval, null);
}
var fieInfo = reval.GetType().GetField(fieldName);
if (fieInfo != null)
{
reval = fieInfo.GetValue(reval);
}
if (fieInfo == null && proInfo == null)
{
var fieldName = memberExpr.Member.Name;
var proInfo = reval.GetType().GetProperty(fieldName);
if (proInfo != null)
{
reval = proInfo.GetValue(reval, null);
}
var fieInfo = reval.GetType().GetField(fieldName);
if (fieInfo != null)
{
reval = fieInfo.GetValue(reval);
}
if (fieInfo == null && proInfo == null)
{
}
}
}
return reval;
@ -125,7 +123,7 @@ namespace SqlSugar
private static object GetPropertyValue(MemberExpression memberExpr)
{
object reval;
object reval = null;
PropertyInfo pro = (PropertyInfo)memberExpr.Member;
reval = pro.GetValue(memberExpr.Member, null);
if (reval != null && reval.GetType().IsClass && reval.GetType() != ExpressionConst.StringType)

Loading…
Cancel
Save