File: BackchannelJsonSerializerContext.KeyValuePairStringString.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.Tool.csproj (aspire)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Aspire.Cli.Backchannel
{
    internal partial class BackchannelJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.KeyValuePair<string, string>>? _KeyValuePairStringString;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.KeyValuePair<string, string>> KeyValuePairStringString
        {
            get => _KeyValuePairStringString ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.KeyValuePair<string, string>>)Options.GetTypeInfo(typeof(global::System.Collections.Generic.KeyValuePair<string, string>));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.KeyValuePair<string, string>> Create_KeyValuePairStringString(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Collections.Generic.KeyValuePair<string, string>>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Collections.Generic.KeyValuePair<string, string>> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::System.Collections.Generic.KeyValuePair<string, string>>
                {
                    ObjectCreator = null,
                    ObjectWithParameterizedConstructorCreator = static args => new global::System.Collections.Generic.KeyValuePair<string, string>((string)args[0], (string)args[1]),
                    PropertyMetadataInitializer = _ => KeyValuePairStringStringPropInit(options),
                    ConstructorParameterMetadataInitializer = KeyValuePairStringStringCtorParamInit,
                    SerializeHandler = KeyValuePairStringStringSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::System.Collections.Generic.KeyValuePair<string, string>>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] KeyValuePairStringStringPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[2];
 
            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::System.Collections.Generic.KeyValuePair<string, string>),
                Converter = null,
                Getter = static obj => ((global::System.Collections.Generic.KeyValuePair<string, string>)obj).Key,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Key",
                JsonPropertyName = null
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
 
            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::System.Collections.Generic.KeyValuePair<string, string>),
                Converter = null,
                Getter = static obj => ((global::System.Collections.Generic.KeyValuePair<string, string>)obj).Value,
                Setter = null,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Value",
                JsonPropertyName = null
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info1);
 
            return properties;
        }
 
        // Intentionally not a static method because we create a delegate to it. Invoking delegates to instance
        // methods is almost as fast as virtual calls. Static methods need to go through a shuffle thunk.
        private void KeyValuePairStringStringSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Collections.Generic.KeyValuePair<string, string> value)
        {
            writer.WriteStartObject();
 
            writer.WriteString(PropName_Key, ((global::System.Collections.Generic.KeyValuePair<string, string>)value).Key);
            writer.WriteString(PropName_Value, ((global::System.Collections.Generic.KeyValuePair<string, string>)value).Value);
 
            writer.WriteEndObject();
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[] KeyValuePairStringStringCtorParamInit()
        {
            var parameters = new global::System.Text.Json.Serialization.Metadata.JsonParameterInfoValues[2];
 
            parameters[0] = new()
            {
                Name = "key",
                ParameterType = typeof(string),
                Position = 0,
                HasDefaultValue = false,
                DefaultValue = default(string)
            };
            
            parameters[1] = new()
            {
                Name = "value",
                ParameterType = typeof(string),
                Position = 1,
                HasDefaultValue = false,
                DefaultValue = default(string)
            };
            
            return parameters;
        }
    }
}