/// <summary> /// Visits the member. /// </summary> /// <param name="member">The member.</param> /// <returns></returns> protected override Expression VisitMember(MemberExpression member) { if (member.Member.DeclaringType == typeof(QueryContext)) { _filterExpression.Append(QueryContextEvaluator.Evaluate(member)); return(member); } _filterExpression.Append(MemberEvaluator.Evaluate(member)); return(member); }
private Expression VisitQueryContextMethodCall(MethodCallExpression methodCall) { switch (methodCall.Method.Name) { case "StoredQuery": return(VisitQueryContextStoredQueryMethodCall(methodCall)); default: _filterExpression.Append(QueryContextEvaluator.Evaluate(methodCall)); return(methodCall); } }
private Expression VisitStaticEnumerableMethodCall(MethodCallExpression methodCall) { var memberExpression = methodCall.Arguments[0] as MemberExpression; if (memberExpression != null && memberExpression.Member.DeclaringType == typeof(QueryContext)) { _filterExpression.Append(QueryContextEvaluator.Evaluate(methodCall)); return(methodCall); } switch (methodCall.Method.Name) { case "Contains": return(VisitStaticEnumerableContainsMethodCall(methodCall)); case "Any": return(VisitStaticEnumerableAnyMethodCall(methodCall)); default: throw new NotSupportedException(string.Format(Resources.VisitMethodCall_The_method_call_0_on_type_1_is_not_supported, methodCall.Method.Name, methodCall.Method.DeclaringType)); } }