File: BackchannelJsonSerializerContext.EnvVar.g.cs
Project: src\src\Aspire.Cli\Aspire.Cli.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::Aspire.Cli.Backchannel.EnvVar>? _EnvVar;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.EnvVar> EnvVar
        {
            get => _EnvVar ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.EnvVar>)Options.GetTypeInfo(typeof(global::Aspire.Cli.Backchannel.EnvVar));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.EnvVar> Create_EnvVar(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Aspire.Cli.Backchannel.EnvVar>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Aspire.Cli.Backchannel.EnvVar> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Aspire.Cli.Backchannel.EnvVar>
                {
                    ObjectCreator = () => new global::Aspire.Cli.Backchannel.EnvVar(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => EnvVarPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    SerializeHandler = EnvVarSerializeHandler
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Aspire.Cli.Backchannel.EnvVar>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }
 
        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] EnvVarPropInit(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::Aspire.Cli.Backchannel.EnvVar),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.EnvVar)obj).Name,
                Setter = static (obj, value) => ((global::Aspire.Cli.Backchannel.EnvVar)obj).Name = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Name",
                JsonPropertyName = "name"
            };
            
            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::Aspire.Cli.Backchannel.EnvVar),
                Converter = null,
                Getter = static obj => ((global::Aspire.Cli.Backchannel.EnvVar)obj).Value,
                Setter = static (obj, value) => ((global::Aspire.Cli.Backchannel.EnvVar)obj).Value = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Value",
                JsonPropertyName = "value"
            };
            
            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 EnvVarSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Aspire.Cli.Backchannel.EnvVar? value)
        {
            if (value == null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();
 
            writer.WriteString(PropName_name, ((global::Aspire.Cli.Backchannel.EnvVar)value).Name);
            writer.WriteString(PropName_value, ((global::Aspire.Cli.Backchannel.EnvVar)value).Value);
 
            writer.WriteEndObject();
        }
    }
}