コード例 #1
0
        internal static MetadataAsDictionary MaterializeFromBlittable(BlittableJsonReaderObject metadata)
        {
            var result = new MetadataAsDictionary((Dictionary <string, object>)null);

            result.Initialize(metadata);

            return(result);
        }
コード例 #2
0
        private object ConvertValue(string key, object value)
        {
            if (value == null)
            {
                return(null);
            }

            if (value is LazyStringValue || value is LazyCompressedStringValue)
            {
                return(value.ToString());
            }

            if (value is long l)
            {
                return(l);
            }

            if (value is bool b)
            {
                return(b);
            }

            if (value is LazyNumberValue doubleValue)
            {
                return((double)doubleValue);
            }

            if (value is BlittableJsonReaderObject obj)
            {
                var dictionary = new MetadataAsDictionary(obj, this, key);
                dictionary.Initialize(obj);
                return(dictionary);
            }

            if (value is BlittableJsonReaderArray array)
            {
                var result = new object[array.Length];
                for (int i = 0; i < array.Length; i++)
                {
                    result[i] = ConvertValue(key, array[i]);
                }
                return(result);
            }

            throw new NotImplementedException("Implement support for numbers and more");
        }