public static CheckStaticMethod ( |
||
methodCallExpression | ||
return | void |
public Expression Transform(MethodCallExpression methodCallExpression) { ArgumentUtility.CheckNotNull("methodCallExpression", methodCallExpression); if (methodCallExpression.Arguments.Count == 1) { MethodCallTransformerUtility.CheckInstanceMethod(methodCallExpression); return(ConversionUtility.MakeBinaryWithOperandConversion( ExpressionType.Equal, methodCallExpression.Object, methodCallExpression.Arguments[0], false, null)); } else if (methodCallExpression.Arguments.Count == 2) { MethodCallTransformerUtility.CheckStaticMethod(methodCallExpression); return(ConversionUtility.MakeBinaryWithOperandConversion( ExpressionType.Equal, methodCallExpression.Arguments[0], methodCallExpression.Arguments[1], false, null)); } var message = string.Format( "{0} function with {1} arguments is not supported. Expression: '{2}'", methodCallExpression.Method.Name, methodCallExpression.Arguments.Count, methodCallExpression); throw new NotSupportedException(message); }
public Expression Transform(MethodCallExpression methodCallExpression) { ArgumentUtility.CheckNotNull("methodCallExpression", methodCallExpression); MethodCallTransformerUtility.CheckArgumentCount(methodCallExpression, 2); MethodCallTransformerUtility.CheckStaticMethod(methodCallExpression); return(new SqlLikeExpression(methodCallExpression.Arguments[0], methodCallExpression.Arguments[1], new SqlLiteralExpression(@"\"))); }
public Expression Transform(MethodCallExpression methodCallExpression) { ArgumentUtility.CheckNotNull("methodCallExpression", methodCallExpression); MethodCallTransformerUtility.CheckArgumentCount(methodCallExpression, 1); MethodCallTransformerUtility.CheckStaticMethod(methodCallExpression); return(new SqlConvertExpression(methodCallExpression.Type, methodCallExpression.Arguments[0])); }
public Expression Transform(MethodCallExpression methodCallExpression) { ArgumentUtility.CheckNotNull("methodCallExpression", methodCallExpression); MethodCallTransformerUtility.CheckArgumentCount(methodCallExpression, 1); MethodCallTransformerUtility.CheckStaticMethod(methodCallExpression); var isNullExpression = new SqlIsNullExpression(methodCallExpression.Arguments[0]); var lenExpression = new SqlLengthExpression(methodCallExpression.Arguments[0]); var lenIsZeroExpression = Expression.Equal(lenExpression, new SqlLiteralExpression(0)); return(Expression.OrElse(isNullExpression, lenIsZeroExpression)); }
public Expression Transform(MethodCallExpression methodCallExpression) { MethodCallTransformerUtility.CheckArgumentCount(methodCallExpression, 2, 3); MethodCallTransformerUtility.CheckStaticMethod(methodCallExpression); if (methodCallExpression.Arguments.Count == 2) // overload without language { return(new SqlFunctionExpression(typeof(bool), "CONTAINS", methodCallExpression.Arguments[0], methodCallExpression.Arguments[1])); } else { MethodCallTransformerUtility.CheckConstantExpression(methodCallExpression.Method.Name, methodCallExpression.Arguments[2], "language parameter"); var compositeExpression = new SqlCompositeCustomTextGeneratorExpression( typeof(string), new SqlCustomTextExpression("LANGUAGE ", typeof(string)), methodCallExpression.Arguments[2]); return(new SqlFunctionExpression( typeof(bool), "CONTAINS", methodCallExpression.Arguments[0], methodCallExpression.Arguments[1], compositeExpression)); } }