Ejemplo n.º 1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType != JsonToken.StartObject)
            {
                return(null);
            }
            var container = new QueryContainer();

            serializer.Populate(reader, container);
            var agg = new FilterAggregation();

            agg.Filter = container;
            return(agg);
        }
        public IFilterAggregation Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
        {
            if (reader.GetCurrentJsonToken() != JsonToken.BeginObject)
            {
                return(null);
            }

            var formatter = formatterResolver.GetFormatter <QueryContainer>();
            var container = formatter.Deserialize(ref reader, formatterResolver);
            var agg       = new FilterAggregation
            {
                Filter = container
            };

            return(agg);
        }