// // Summary: // Visits the System.Linq.Expressions.ConstantExpression. // // Parameters: // node: // The expression to visit. // // Returns: // The modified expression, if it or any subexpression was modified; otherwise, // returns the original expression. protected override Expression VisitConstant(ConstantExpression node) { Console.WriteLine("VisitConstant:"); Console.WriteLine('\t' + node.GetType().ToString()); Console.WriteLine('\t' + node.ToString()); return(base.VisitConstant(node)); }
private static int PrintConstant(ConstantExpression expression) { Write("ToString: " + expression); Write("GetType: " + expression.GetType()); Write("NodeType: " + expression.NodeType); Write("Type: " + expression.Type); Write("Value: " + expression.Value); return(0); }
private static bool CompareConstant(ConstantExpression a, ConstantExpression b) { if (a.Value == b.Value) { return(true); } if (a.Value == null || b.Value == null) { return(false); } if (a.Value is EnumerableQuery && b.Value is EnumerableQuery) { return(false); // EnumerableQueries are opaque } /* * if (a.IsEntityQueryable() * && b.IsEntityQueryable() * && a.Value.GetType() == b.Value.GetType()) * { * return true; * } */ if (typeof(ExpressionQuery <>).IsSameOrParentOf(a.GetType()) && typeof(ExpressionQuery <>).IsSameOrParentOf(b.GetType()) && a.Value.GetType() == b.Value.GetType()) { return(true); } return(Equals(a.Value, b.Value)); }