/// <summary>
        ///     create like expression
        /// </summary>
        /// <returns></returns>
        private static Expression <Func <T, bool> > GetLkExpression <T>(ParameterExpression parameter,
                                                                        RSqlQueryParser.ComparisonContext context,
                                                                        JsonNamingPolicy jsonNamingPolicy = null)
        {
            var expressionValue = GetSelector <T>(parameter, context, jsonNamingPolicy);
            var values          = RSqlQueryGetValueHelper.GetValues(expressionValue.Property.PropertyType, context.arguments());

            if (values.Count > 1)
            {
                throw new ComparisonTooManyArgumentException(context);
            }

            var criteria = Convert.ToString(values[0]) ?? string.Empty;
            var maskStar = "{" + Guid.NewGuid() + "}";

            criteria = criteria.Replace(@"\*", maskStar);
            MethodInfo method;

            if (!criteria.Contains('*'))
            {
                criteria += '*';
            }

            if (criteria.StartsWith("*", StringComparison.Ordinal) && criteria.EndsWith("*", StringComparison.Ordinal))
            {
                method = QueryReflectionHelper.MethodStringContains;
            }
            else if (criteria.StartsWith("*", StringComparison.Ordinal))
            {
                method = QueryReflectionHelper.MethodStringEndsWith;
            }
            else
            {
                method = QueryReflectionHelper.MethodStringStartsWith;
            }

            criteria = criteria.Replace("*", "").Replace(maskStar, "*");
            return(Expression.Lambda <Func <T, bool> >(Expression.Call(expressionValue.Expression,
                                                                       method,
                                                                       Expression.Constant(criteria, expressionValue.Property.PropertyType)), parameter));
        }
        /// <summary>
        ///     create is null expression ( operator "=is-null=" or "=nil=" )
        /// </summary>
        /// <param name="parameter"></param>
        /// <param name="context"></param>
        /// <param name="jsonNamingPolicy"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static Expression <Func <T, bool> > GetIsNullExpression <T>(ParameterExpression parameter,
                                                                           RSqlQueryParser.ComparisonContext context,
                                                                           JsonNamingPolicy jsonNamingPolicy = null)
        {
            var expressionValue = GetSelector <T>(parameter, context, jsonNamingPolicy);

            if (!RSqlQueryGetValueHelper.IsNullableComparisonType(expressionValue.Property.PropertyType))
            {
                throw new ComparisonInvalidComparatorSelectionException(context);
            }

            var values = RSqlQueryGetValueHelper.GetValues(typeof(bool), context.arguments());

            if (!values.Any())
            {
                throw new ComparisonNotEnoughArgumentException(context);
            }

            if (values.Count > 1)
            {
                throw new ComparisonTooManyArgumentException(context);
            }

            var result = Expression.Lambda <Func <T, bool> >(Expression.Equal(
                                                                 expressionValue.Expression,
                                                                 Expression.Constant(null, typeof(object))), parameter);

            if ((bool)values[0])
            {
                return(result);
            }

            var body = Expression.Not(result.Body);

            result = Expression.Lambda <Func <T, bool> >(body, parameter);
            return(result);
        }
 /// <summary>
 /// extract the multi value
 /// </summary>
 /// <param name="expressionValue"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 /// <exception cref="ComparisonNotEnoughArgumentException"></exception>
 private static List <object> GetMultipleValue(ExpressionValue expressionValue,
                                               RSqlQueryParser.ComparisonContext context)
 {
     return(RSqlQueryGetValueHelper.GetValues(expressionValue.Property.PropertyType, context.arguments()));
 }