public string Serialize(FalcorResponse response)
 {
     var result = new JObject();
     result["jsonGraph"] = SerializationHelper.SerializeItem(response.JsonGraph);
     var stringWriter = new StringWriter();
     _jsonSerializer.Serialize(stringWriter, result);
     return stringWriter.ToString();
 }
Esempio n. 2
0
        public async Task <FalcorResponse> RouteAsync(FalcorRequest request)
        {
            await Route(request).ToList().ToTask();

            var response = FalcorResponse.From(_results);

            return(response);
        }
Esempio n. 3
0
        public string Serialize(FalcorResponse response)
        {
            var result = new JObject();

            result["jsonGraph"] = SerializationHelper.SerializeItem(response.JsonGraph);
            var stringWriter = new StringWriter();

            _jsonSerializer.Serialize(stringWriter, result);
            return(stringWriter.ToString());
        }
Esempio n. 4
0
        public static FalcorResponse From(IReadOnlyList<PathValue> results)
        {
            var jsonGraph = new Dictionary<string, object>();

            foreach (var pathValue in results)
                AddPath(jsonGraph, pathValue.Path, pathValue.Value);

            IList<IList<string>> paths = results
                .Select(pv => pv.Path)
                .Select(path => (IList<string>) path.Select(key => key.ToString()).ToList())
                .ToList();

            var response = new FalcorResponse(jsonGraph, paths);

            return response;
        }
        public FalcorResponse CreateResponse()
        {
            var jsonGraph = new Dictionary<string, object>();

            foreach (var pathValue in _pathValues)
                AddPath(jsonGraph, pathValue.Path, pathValue.Value);

            IList<IList<string>> paths = _pathValues
                .Select(pv => pv.Path)
                .Select(path => (IList<string>)path.Select(key => key.ToString()).ToList())
                .ToList();

            var response = new FalcorResponse(jsonGraph, paths);

            return response;
        }
Esempio n. 6
0
        public static FalcorResponse From(IReadOnlyList <PathValue> results)
        {
            var jsonGraph = new Dictionary <string, object>();

            foreach (var pathValue in results)
            {
                AddPath(jsonGraph, pathValue.Path, pathValue.Value);
            }

            IList <IList <string> > paths = results
                                            .Select(pv => pv.Path)
                                            .Select(path => (IList <string>)path.Select(key => key.ToString()).ToList())
                                            .ToList();

            var response = new FalcorResponse(jsonGraph, paths);

            return(response);
        }