コード例 #1
0
        /// <summary>
        /// Creates a new instance of <see cref="DefaultHttpResultSerializer" />.
        /// </summary>
        /// <param name="batchSerialization">
        /// Specifies the output-format for batched queries.
        /// </param>
        /// <param name="deferSerialization">
        /// Specifies the output-format for deferred queries.
        /// </param>
        /// <param name="indented">
        /// Defines whether the underlying <see cref="Utf8JsonWriter"/>
        /// should pretty print the JSON which includes:
        /// indenting nested JSON tokens, adding new lines, and adding
        /// white space between property names and values.
        /// By default, the JSON is written without extra white spaces.
        /// </param>
        public DefaultHttpResultSerializer(
            HttpResultSerialization batchSerialization = HttpResultSerialization.MultiPartChunked,
            HttpResultSerialization deferSerialization = HttpResultSerialization.MultiPartChunked,
            bool indented = false)
        {
            _batchSerialization = batchSerialization;
            _deferSerialization = deferSerialization;

            _jsonSerializer      = new(indented);
            _jsonArraySerializer = new(indented);
            _multiPartSerializer = new(indented);
        }