Example #1
0
        private List <TResult> ParseResults <TResult>(IEnumerable <IRecord> result, CypherQuery query)
        {
            var deserializer = new CypherJsonDeserializer <TResult>(this, query.ResultMode, query.ResultFormat, false, true);
            var results      = new List <TResult>();

            if (typeof(TResult).IsAnonymous())
            {
                foreach (var record in result)
                {
                    results.AddRange(deserializer.Deserialize(record.ParseAnonymous(this), false));
                }
            }
            else
            {
                StatementResultHelper.JsonSettings = new JsonSerializerSettings
                {
                    Converters       = JsonConverters,
                    ContractResolver = JsonContractResolver
                };

                List <IEnumerable <TResult> > converted = new List <IEnumerable <TResult> >();
                foreach (var record in result)
                {
                    var des = record.Deserialize(deserializer, query.ResultMode);
                    converted.Add(des);
                }

                foreach (var enumerable in converted)
                {
                    results.AddRange(enumerable);
                }
            }

            return(results);
        }
Example #2
0
        private List <TResult> ParseResults <TResult>(IStatementResult result, CypherQuery query)
        {
            var deserializer = new CypherJsonDeserializer <TResult>(this, query.ResultMode, query.ResultFormat, false, true);
            var results      = new List <TResult>();

            if (typeof(TResult).IsAnonymous())
            {
                foreach (var record in result)
                {
                    results.AddRange(deserializer.Deserialize(record.ParseAnonymous(this)));
                }
            }
            else
            {
                var converted = result.Select(record => record.Deserialize(deserializer, query.ResultMode));
                foreach (var enumerable in converted)
                {
                    results.AddRange(enumerable);
                }
            }

            return(results);
        }