示例#1
0
        public override IEnumerable <Tuple <string, string> > FlattenJToken(JToken jt)
        {
            if (jt != null && this.Fields != null && this.Fields.Count > 0)
            {
                var ns = jt[NamespaceField].ToString();

                var mapping = new FlattenerMappingObject()
                {
                    Fields    = Fields,
                    Namespace = ns
                };

                foreach (var p in mapping.FlattenJToken(jt))
                {
                    yield return(Tuple.Create(BuildPropertyName(Namespace, p.Item1), p.Item2));
                }
            }
        }
        public override IEnumerable <Tuple <string, string> > FlattenJToken(JToken jt)
        {
            if (jt != null && this.Fields != null && this.Fields.Count > 0)
            {
                var jo      = jt.Value <JObject>();
                var mapping = new FlattenerMappingObject()
                {
                    Fields = Fields
                };

                foreach (var prop in jo.Properties())
                {
                    var ns = BuildPropertyName(Namespace, prop.Name);

                    foreach (var p in mapping.FlattenJToken(prop.Value))
                    {
                        yield return(Tuple.Create(BuildPropertyName(ns, p.Item1), p.Item2));
                    }
                }
            }
        }