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)); }
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); }
public static string ApplyRangeSuffixIfNecessary(string fieldName, Type type) { var rangeType = DocumentConventions.GetRangeType(type); return(ApplyRangeSuffixIfNecessary(fieldName, rangeType)); }