/// <summary> /// 重载访问UnaryExpression /// </summary> /// <param name="u"></param> /// <returns></returns> protected override Expression VisitUnary(UnaryExpression u) { ConstantExpression result; if (LocalDMSExpressionChecker.TryMatchLocalExpression(u, out result)) { return(result); } return(base.VisitUnary(u)); }
/// <summary> /// 重载访问NewArrayExpression /// </summary> /// <param name="na"></param> /// <returns></returns> protected override Expression VisitNewArray(NewArrayExpression na) { ConstantExpression result; if (LocalDMSExpressionChecker.TryMatchLocalExpression(na, out result)) { return(result); } return(base.VisitNewArray(na)); }
/// <summary> /// /// </summary> /// <param name="expr"></param> /// <param name="constExpr"></param> /// <returns></returns> internal static bool TryMatchLocalExpression(Expression expr, out ConstantExpression constExpr) { FunctionReturningObject functionReturningObject; if (LocalDMSExpressionChecker.TryMatchLocalExpression(expr, out functionReturningObject)) { constExpr = Expression.Constant(functionReturningObject(), expr.Type); return(true); } constExpr = null; return(false); }
/// <summary> /// 重载访问MemberExpression /// </summary> /// <param name="m"></param> /// <returns></returns> protected override Expression VisitMemberAccess(MemberExpression m) { ConstantExpression result; if (m != null && m.Expression == null) { result = LocalDMSExpressionChecker.ConvertConstantExpression(m); return(result); } if (LocalDMSExpressionChecker.TryMatchLocalExpression(m, out result)) { return(result); } return(base.VisitMemberAccess(m)); }
/// <summary> /// 重载访问MethodCallExpression /// </summary> /// <param name="m"></param> /// <returns></returns> protected override Expression VisitMethodCall(MethodCallExpression m) { ConstantExpression result; if (LocalDMSExpressionChecker.TryMatchLocalExpression(m, out result)) { return(result); } MethodCallExpression mResult; //子查询处理器 if (LocalDMSExpressionChecker.TryMatchLocalExpression(m, out mResult)) { return(mResult); } return(base.VisitMethodCall(m)); }