File: _generated\108\WorkloadHistoryJsonSerializerContext.WorkloadHistoryRecord.g.cs
Web Access
Project: src\src\sdk\src\Cli\dotnet\dotnet.csproj (dotnet)
// <auto-generated/>

#nullable enable annotations
#nullable disable warnings

// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618

namespace Microsoft.DotNet.Cli.Commands.Workload
{
    internal partial class WorkloadHistoryJsonSerializerContext
    {
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord>? _WorkloadHistoryRecord;
        
        /// <summary>
        /// Defines the source generated JSON serialization contract metadata for a given type.
        /// </summary>
        #nullable disable annotations // Marking the property type as nullable-oblivious.
        public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord> WorkloadHistoryRecord
        #nullable enable annotations
        {
            get => _WorkloadHistoryRecord ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord>)Options.GetTypeInfo(typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord));
        }
        
        private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord> Create_WorkloadHistoryRecord(global::System.Text.Json.JsonSerializerOptions options)
        {
            if (!TryGetTypeInfoForRuntimeCustomConverter<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord> jsonTypeInfo))
            {
                var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord>
                {
                    ObjectCreator = () => new global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord(),
                    ObjectWithParameterizedConstructorCreator = null,
                    PropertyMetadataInitializer = _ => WorkloadHistoryRecordPropInit(options),
                    ConstructorParameterMetadataInitializer = null,
                    ConstructorAttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetConstructor(InstanceMemberBindingFlags, binder: null, global::System.Array.Empty<global::System.Type>(), modifiers: null),
                    SerializeHandler = WorkloadHistoryRecordSerializeHandler,
                };
                
                jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord>(options, objectInfo);
                jsonTypeInfo.NumberHandling = null;
            }
        
            jsonTypeInfo.OriginatingResolver = this;
            return jsonTypeInfo;
        }

        private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] WorkloadHistoryRecordPropInit(global::System.Text.Json.JsonSerializerOptions options)
        {
            var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[10];

            var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.DateTimeOffset>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).TimeStarted,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).TimeStarted = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "TimeStarted",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("TimeStarted", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.DateTimeOffset>(options, info0);

            var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.DateTimeOffset>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).TimeCompleted,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).TimeCompleted = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "TimeCompleted",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("TimeCompleted", InstanceMemberBindingFlags, null, typeof(global::System.DateTimeOffset), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.DateTimeOffset>(options, info1);

            var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).CommandName,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).CommandName = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "CommandName",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("CommandName", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[2] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info2);

            var info3 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Collections.Generic.Dictionary<string, string>>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).RollbackFileContents,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).RollbackFileContents = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "RollbackFileContents",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("RollbackFileContents", InstanceMemberBindingFlags, null, typeof(global::System.Collections.Generic.Dictionary<string, string>), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[3] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Collections.Generic.Dictionary<string, string>>(options, info3);

            var info4 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string[]>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).CommandLineArgs,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).CommandLineArgs = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "CommandLineArgs",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("CommandLineArgs", InstanceMemberBindingFlags, null, typeof(string[]), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[4] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string[]>(options, info4);

            var info5 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<bool>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).Succeeded,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).Succeeded = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "Succeeded",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("Succeeded", InstanceMemberBindingFlags, null, typeof(bool), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[5] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<bool>(options, info5);

            var info6 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).ErrorMessage,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).ErrorMessage = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "ErrorMessage",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("ErrorMessage", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[6] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info6);

            var info7 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).StateBeforeCommand,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).StateBeforeCommand = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "StateBeforeCommand",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("StateBeforeCommand", InstanceMemberBindingFlags, null, typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[7] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState>(options, info7);

            var info8 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).StateAfterCommand,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).StateAfterCommand = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "StateAfterCommand",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("StateAfterCommand", InstanceMemberBindingFlags, null, typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[8] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryState>(options, info8);

            var info9 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
            {
                IsProperty = true,
                IsPublic = true,
                IsVirtual = false,
                DeclaringType = typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord),
                Converter = null,
                Getter = static obj => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).GlobalJsonVersion,
                Setter = static (obj, value) => ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)obj).GlobalJsonVersion = value!,
                IgnoreCondition = null,
                HasJsonInclude = false,
                IsExtensionData = false,
                NumberHandling = null,
                PropertyName = "GlobalJsonVersion",
                JsonPropertyName = null,
                AttributeProviderFactory = static () => typeof(global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord).GetProperty("GlobalJsonVersion", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
            };
            
            properties[9] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info9);

            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 WorkloadHistoryRecordSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord? value)
        {
            if (value is null)
            {
                writer.WriteNullValue();
                return;
            }
            
            writer.WriteStartObject();

            writer.WriteString(PropName_TimeStarted, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).TimeStarted);
            writer.WriteString(PropName_TimeCompleted, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).TimeCompleted);
            writer.WriteString(PropName_CommandName, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).CommandName);
            writer.WritePropertyName(PropName_RollbackFileContents);
            DictionaryStringStringSerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).RollbackFileContents);
            writer.WritePropertyName(PropName_CommandLineArgs);
            StringArraySerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).CommandLineArgs);
            writer.WriteBoolean(PropName_Succeeded, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).Succeeded);
            writer.WriteString(PropName_ErrorMessage, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).ErrorMessage);
            writer.WritePropertyName(PropName_StateBeforeCommand);
            WorkloadHistoryStateSerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).StateBeforeCommand);
            writer.WritePropertyName(PropName_StateAfterCommand);
            WorkloadHistoryStateSerializeHandler(writer, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).StateAfterCommand);
            writer.WriteString(PropName_GlobalJsonVersion, ((global::Microsoft.DotNet.Cli.Commands.Workload.WorkloadHistoryRecord)value).GlobalJsonVersion);

            writer.WriteEndObject();
        }
    }
}