Ejemplo n.º 1
0
        public static IQueryResult Deserialize(
            IReadOnlyDictionary <string, object?> serializedResult)
        {
            var result = new QueryResultBuilder();

            if (serializedResult.TryGetValue(_data, out object?data))
            {
                result.SetData(data as IReadOnlyDictionary <string, object?>);
            }

            if (serializedResult.TryGetValue(_extensions, out object?extensionData))
            {
                result.SetExtensions(extensionData as IReadOnlyDictionary <string, object?>);
            }

            DeserializeErrors(result, serializedResult);

            return(result.Create());
        }
        public static IReadOnlyQueryResult Deserialize(
            IReadOnlyDictionary <string, object> serializedResult)
        {
            var result        = new QueryResultBuilder();
            var data          = new OrderedDictionary();
            var extensionData = new ExtensionData();

            DeserializeRootField(
                data,
                serializedResult,
                _data);
            result.SetData(data);

            DeserializeRootField(
                extensionData,
                serializedResult,
                _extensions);
            result.SetExtensions(extensionData);

            DeserializeErrors(result, serializedResult);

            return(result.Create());
        }