public void Serialize(ref JsonWriter writer, ISpanGapQuery value, IJsonFormatterResolver formatterResolver)
        {
            if (value == null || SpanGapQuery.IsConditionless(value))
            {
                writer.WriteNull();
                return;
            }

            writer.WriteBeginObject();
            var inferrer = formatterResolver.GetConnectionSettings().Inferrer;

            writer.WritePropertyName(inferrer.Field(value.Field));
            writer.WriteInt32(value.Width.Value);
            writer.WriteEndObject();
        }
예제 #2
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var gapQuery = value as ISpanGapQuery;

            if (value == null || SpanGapQuery.IsConditionless(gapQuery))
            {
                writer.WriteNull();
                return;
            }
            var settings  = serializer.GetConnectionSettings();
            var fieldName = settings.Inferrer.Field(gapQuery.Field);

            writer.WriteStartObject();
            writer.WritePropertyName(fieldName);
            writer.WriteValue(gapQuery.Width);
            writer.WriteEndObject();
        }