Exemplo n.º 1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
                                        JsonSerializer serializer)
        {
            var r = new Dictionary <PropertyNameMarker, IElasticType>();

            JObject o = JObject.Load(reader);

            foreach (var p in o.Properties())
            {
                var name = p.Name;
                var po   = p.First as JObject;
                if (po == null)
                {
                    continue;
                }

                var mapping = new ElasticTypeConverter().ReadJson(po.CreateReader(), objectType, existingValue, serializer)
                              as IElasticType;
                if (mapping == null)
                {
                    continue;
                }
                mapping.Name = name;

                r.Add(name, mapping);
            }
            return(r);
        }
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
										JsonSerializer serializer)
		{
			var r = new Dictionary<PropertyNameMarker, IElasticType>();

			JObject o = JObject.Load(reader);

			foreach (var p in o.Properties())
			{
				var name = p.Name;
				var po = p.First as JObject;
				if (po == null)
					continue;

				var mapping = new ElasticTypeConverter().ReadJson(po.CreateReader(), objectType, existingValue, serializer)
					 as IElasticType;
				if (mapping == null)
					continue;
				mapping.Name = name;

				r.Add(name, mapping);

			}
			return r;
		}