Esempio n. 1
0
        public override void Write(Utf8JsonWriter writer, MultiFilter value, JsonSerializerOptions options)
        {
            MultiFilter mf = value;
#endif
            writer.WriteStartObject();

            writer.WritePropertyName(MultiFilter.LogicJsonPropertyName);
#if NETSTANDARD1_3
            writer.WriteValue(mf.Logic.ToString().ToLower());
#else
            writer.WriteStringValue(mf.Logic.ToString().ToLower());
#endif

            writer.WritePropertyName(MultiFilter.FiltersJsonPropertyName);
            writer.WriteStartArray();
            foreach (IFilter filter in mf.Filters)
            {
#if NETSTANDARD1_3
                serializer.Serialize(writer, filter);
#else
                if (filter is Filter f)
                {
                    _filterConverter.Write(writer, f, options);
                }
                else if (filter is MultiFilter multiFilter)
                {
                    Write(writer, multiFilter, options);
                }
#endif
            }
            writer.WriteEndArray();

            writer.WriteEndObject();
        }