public bool TryGetMethodCallMapping(MethodInfo method, out ExpressionMappingDelegate <MethodCallExpression> methodCallMapping)
 {
     if (method.IsGenericMethod)
     {
         method = method.GetGenericMethodDefinition();
     }
     return(methodCallMappingRegistry.TryGetValue(method, out methodCallMapping));
 }
 public void RegisterMethodCallMapping(MethodInfo method, ExpressionMappingDelegate <MethodCallExpression> methodCallMapping)
 {
     if (method.IsGenericMethod)
     {
         method = method.GetGenericMethodDefinition();
     }
     methodCallMappingRegistry[method] = methodCallMapping;
 }
        public void RegisterMemberAccessMapping(Type targetType, string memberName, ExpressionMappingDelegate <MemberExpression> memberAccessMapping)
        {
            if (targetType.IsGenericType)
            {
                targetType = targetType.GetGenericTypeDefinition();
            }

            memberAccessMappingRegistry[Tuple.Create(targetType, memberName)] = memberAccessMapping;
        }
        public bool TryGetMemberAccessMapping(MemberInfo member, out ExpressionMappingDelegate <MemberExpression> memberAccessMapping)
        {
            if (memberAccessMappingRegistry.TryGetValue(Tuple.Create(member.DeclaringType, member.Name), out memberAccessMapping))
            {
                return(true);
            }

            if (member.DeclaringType.IsGenericType)
            {
                if (memberAccessMappingRegistry.TryGetValue(Tuple.Create(member.DeclaringType.GetGenericTypeDefinition(), member.Name), out memberAccessMapping))
                {
                    return(true);
                }
            }

            return(false);
        }
 public void RegisterUnaryExpressionMapping <TExpression>(ExpressionType expressionType, ExpressionMappingDelegate <UnaryExpression> unaryExpressionMapping)
 {
     unaryExpressionMappingRegistry[Tuple.Create(typeof(TExpression), expressionType)] = unaryExpressionMapping;
 }
 public void RegisterBinaryExpressionMapping(Type leftType, Type rightType, ExpressionType expressionType, ExpressionMappingDelegate <BinaryExpression> binaryExpressionMapping)
 {
     binaryExpressionMappingRegistry[Tuple.Create(leftType, rightType, expressionType)] = binaryExpressionMapping;
 }
 public void RegisterBinaryExpressionMapping <TLeft, TRight>(ExpressionType expressionType, ExpressionMappingDelegate <BinaryExpression> binaryExpressionMapping)
 {
     binaryExpressionMappingRegistry[Tuple.Create(typeof(TLeft), typeof(TRight), expressionType)] = binaryExpressionMapping;
 }
 public void RegisterNewExpressionMapping(ConstructorInfo constructor, ExpressionMappingDelegate <NewExpression> newExpressionMapping)
 {
     newExpressionMappingRegistry[constructor] = newExpressionMapping;
 }
 public void RegisterMethodCallMapping(MethodInfo method, ExpressionMappingDelegate <MethodCallExpression> methodCallMapping)
 {
     method = GetMostGenericVersionOfMethod(method);
     methodCallMappingRegistry[method] = methodCallMapping;
 }
 public bool TryGetUnaryExpressionMapping(Type expression, ExpressionType expressionType, out ExpressionMappingDelegate <UnaryExpression> unaryExpressionMapping)
 {
     return(unaryExpressionMappingRegistry.TryGetValue(Tuple.Create(expression, expressionType), out unaryExpressionMapping));
 }
 public bool TryGetBinaryExpressionMapping(Type leftType, Type rightType, ExpressionType expressionType, out ExpressionMappingDelegate <BinaryExpression> binaryExpressionMapping)
 {
     return(binaryExpressionMappingRegistry.TryGetValue(Tuple.Create(leftType, rightType, expressionType), out binaryExpressionMapping));
 }
 public bool TryGetNewExpressionMapping(ConstructorInfo constructor, out ExpressionMappingDelegate <NewExpression> newExpressionMapping)
 {
     return(newExpressionMappingRegistry.TryGetValue(constructor, out newExpressionMapping));
 }
 public bool TryGetMethodCallMapping(MethodInfo method, out ExpressionMappingDelegate <MethodCallExpression> methodCallMapping)
 {
     method = GetMostGenericVersionOfMethod(method);
     return(methodCallMappingRegistry.TryGetValue(method, out methodCallMapping));
 }
 public void RegisterUnaryExpressionMapping(Type operandType, ExpressionType expressionType, ExpressionMappingDelegate <UnaryExpression> unaryExpressionMapping)
 {
     unaryExpressionMappingRegistry[Tuple.Create(operandType, expressionType)] = unaryExpressionMapping;
 }