Exemple #1
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var action = (IndexAction <T>)value;

            var injectingWriter = new InjectingJsonWriter(writer);

            injectingWriter.OnStart =
                w =>
            {
                w.WritePropertyName("@search.action");
                w.WriteValue(SearchIndexClient.IndexActionTypeToString(action.ActionType));
            };

            serializer.Serialize(injectingWriter, action.Document);
        }
Exemple #2
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var action = (IndexActionBase <T>)value;

            var injectingWriter = new InjectingJsonWriter(writer);

            injectingWriter.OnStart =
                w =>
            {
                w.WritePropertyName("@search.action");

                var converter = new StringEnumConverter();
                converter.WriteJson(w, action.ActionType, serializer);
            };

            serializer.Serialize(injectingWriter, action.Document);
        }
Exemple #3
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var action = (IndexAction <T>)value;

            void WriteActionAnnotation(JsonWriter innerWriter)
            {
                innerWriter.WritePropertyName("@search.action");

                var converter = new StringEnumConverter();

                converter.WriteJson(innerWriter, action.ActionType, serializer);
            }

            var injectingWriter = new InjectingJsonWriter(writer)
            {
                OnStart = WriteActionAnnotation
            };

            serializer.Serialize(injectingWriter, action.Document);
        }