Exemplo n.º 1
0
        private string GetFieldNameForRangeQuery(ExpressionInfo expression, object value)
        {
            var identityProperty = luceneQuery.DocumentConvention.GetIdentityProperty(typeof(T));

            if (identityProperty != null && identityProperty.Name == expression.Path)
            {
                return(Constants.DocumentIdFieldName);
            }
            if (value is int || value is long || value is double || value is float || value is decimal)
            {
                return(expression.Path + "_Range");
            }
            return(expression.Path);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets member info for the specified expression and the path to that expression
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        protected override ExpressionInfo GetMember(System.Linq.Expressions.Expression expression)
        {
            var parameterExpression = expression as ParameterExpression;

            if (parameterExpression != null)
            {
                return(new ExpressionInfo(CurrentPath, parameterExpression.Type, false));
            }

            var memberExpression = GetMemberExpression(expression);

            //for standard queries, we take just the last part. But for dynamic queries, we take the whole part
            var path = memberExpression.ToString();

            path = path.Substring(path.IndexOf('.') + 1);


            var info = new ExpressionInfo(path, memberExpression.Member.GetMemberType(), memberExpression.Expression is MemberExpression);

            return(new ExpressionInfo(
                       CurrentPath + info.Path,
                       info.Type,
                       memberExpression.Expression is MemberExpression));
        }
 private static Type GetMemberType(ExpressionInfo info)
 {
     return(info.Type);
 }