Beispiel #1
0
        private static RangeType GetRangeType(Expression <Func <T, object> > path)
        {
            var unaryExpression = path.Body as UnaryExpression;

            if (unaryExpression == null)
            {
                return(RangeType.None);
            }
            if (unaryExpression.NodeType != ExpressionType.Convert &&
                unaryExpression.NodeType != ExpressionType.ConvertChecked)
            {
                return(RangeType.None);
            }

            return(DocumentConventions.GetRangeType(unaryExpression.Operand.Type));
        }
Beispiel #2
0
        public static OrderingType GetOrderingOfType(Type fieldType)
        {
            var rangeType = DocumentConventions.GetRangeType(fieldType);

            var ordering = OrderingType.String;

            switch (rangeType)
            {
            case RangeType.Double:
                ordering = OrderingType.Double;
                break;

            case RangeType.Long:
                ordering = OrderingType.Long;
                break;
            }

            return(ordering);
        }
Beispiel #3
0
        public static string ApplyRangeSuffixIfNecessary(string fieldName, Type type)
        {
            var rangeType = DocumentConventions.GetRangeType(type);

            return(ApplyRangeSuffixIfNecessary(fieldName, rangeType));
        }