コード例 #1
0
        private static IonType buildData1(
            List <KeyValuePair <string, string> > document,
            IIonReader reader,
            IonType type)
        {
            if (type == IonType.Struct)
            {
                reader.StepIn();
                while ((type = reader.MoveNext()) != IonType.None)
                {
                    switch (type)
                    {
                    case IonType.Bool:
                        document.Add(new KeyValuePair <string, string>(reader.CurrentFieldName, Convert.ToString(reader.BoolValue())));
                        continue;

                    case IonType.Int:
                        document.Add(new KeyValuePair <string, string>(reader.CurrentFieldName, Convert.ToString(reader.IntValue())));
                        continue;

                    case IonType.Decimal:
                        document.Add(new KeyValuePair <string, string>(reader.CurrentFieldName, Convert.ToString((object)reader.DecimalValue())));
                        continue;

                    case IonType.Timestamp:
                        document.Add(new KeyValuePair <string, string>(reader.CurrentFieldName, Convert.ToString((object)reader.TimestampValue())));
                        continue;

                    case IonType.String:
                        document.Add(new KeyValuePair <string, string>(reader.CurrentFieldName, reader.StringValue()));
                        continue;

                    case IonType.Struct:
                        int num = (int)ConnectionService.buildData1(document, reader, type);
                        continue;

                    default:
                        continue;
                    }
                }
                reader.StepOut();
            }
            return(type);
        }
コード例 #2
0
        private List <List <KeyValuePair <string, string> > > BuildData(IResult result)
        {
            List <List <KeyValuePair <string, string> > > keyValuePairListList = new List <List <KeyValuePair <string, string> > >();
            IEnumerator <IIonValue> enumerator = result.GetEnumerator();

            while (enumerator.MoveNext())
            {
                List <KeyValuePair <string, string> > document = new List <KeyValuePair <string, string> >();
                using (IIonReader reader = IonReaderBuilder.Build(enumerator.Current, new ReaderOptions()))
                {
                    IonType type;
                    while ((type = reader.MoveNext()) != IonType.None)
                    {
                        ConnectionService.buildData1(document, reader, type);
                    }
                }
                keyValuePairListList.Add(document);
            }
            return(keyValuePairListList);
        }