private Dictionary<string, object> SerializeRangeBucket(RangeBucket bucket) { Dictionary<string, object> bucketDict = new Dictionary<string, object>(); bucketDict.AddObject(_RANGE_KEY, bucket.Key); bucketDict.AddObject(_GREATER_THAN, bucket.GreaterThan); bucketDict.AddObject(_LESS_THAN, bucket.LessThan); bucketDict.AddObject(_GREATER_THAN_OR_EQUAL_TO, bucket.GreaterThanOrEqualTo); bucketDict.AddObject(_LESS_THAN_OR_EQUAL_TO, bucket.LessThanOrEqualTo); return bucketDict; }
private RangeBucket DeserializeRangeBucket(Dictionary<string, object> bucketDict) { RangeBucket bucket = new RangeBucket(); if (bucketDict.ContainsKey(_GREATER_THAN)) bucket.GreaterThan = bucketDict[_GREATER_THAN]; if (bucketDict.ContainsKey(_LESS_THAN)) bucket.LessThan = bucketDict[_LESS_THAN]; if (bucketDict.ContainsKey(_GREATER_THAN_OR_EQUAL_TO)) bucket.GreaterThanOrEqualTo = bucketDict[_GREATER_THAN_OR_EQUAL_TO]; if (bucketDict.ContainsKey(_LESS_THAN_OR_EQUAL_TO)) bucket.LessThanOrEqualTo = bucketDict[_LESS_THAN_OR_EQUAL_TO]; bucket.Key = bucketDict.GetStringOrDefault(_RANGE_KEY); return bucket; }