File: Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestTypesContext.XName.g.cs
Project: ..\..\..\test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Microsoft.Extensions.AI.Abstractions.Tests.csproj (Microsoft.Extensions.AI.Abstractions.Tests)
// <auto-generated/>
 
#nullable enable annotations
#nullable disable warnings
 
// Suppress warnings about [Obsolete] member usage in generated code.
#pragma warning disable CS0612, CS0618
 
namespace Microsoft.Extensions.AI.JsonSchemaExporter
{
    public static partial class TestTypes
    {
        public partial class TestTypesContext
        {
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Xml.Linq.XName>? _XName;
            
            /// <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::System.Xml.Linq.XName> XName
            #nullable enable annotations
            {
                get => _XName ??= (global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Xml.Linq.XName>)Options.GetTypeInfo(typeof(global::System.Xml.Linq.XName));
            }
            
            private global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Xml.Linq.XName> Create_XName(global::System.Text.Json.JsonSerializerOptions options)
            {
                if (!TryGetTypeInfoForRuntimeCustomConverter<global::System.Xml.Linq.XName>(options, out global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::System.Xml.Linq.XName> jsonTypeInfo))
                {
                    var objectInfo = new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues<global::System.Xml.Linq.XName>
                    {
                        ObjectCreator = null,
                        ObjectWithParameterizedConstructorCreator = null,
                        PropertyMetadataInitializer = _ => XNamePropInit(options),
                        ConstructorParameterMetadataInitializer = null,
                        ConstructorAttributeProviderFactory = null,
                        SerializeHandler = XNameSerializeHandler,
                    };
                    
                    jsonTypeInfo = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo<global::System.Xml.Linq.XName>(options, objectInfo);
                    jsonTypeInfo.NumberHandling = null;
                }
            
                jsonTypeInfo.OriginatingResolver = this;
                return jsonTypeInfo;
            }
 
            private static global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[] XNamePropInit(global::System.Text.Json.JsonSerializerOptions options)
            {
                var properties = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[3];
 
                var info0 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::System.Xml.Linq.XName),
                    Converter = null,
                    Getter = static obj => ((global::System.Xml.Linq.XName)obj).LocalName,
                    Setter = null,
                    IgnoreCondition = null,
                    HasJsonInclude = false,
                    IsExtensionData = false,
                    NumberHandling = null,
                    PropertyName = "LocalName",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::System.Xml.Linq.XName).GetProperty("LocalName", InstanceMemberBindingFlags, null, typeof(string), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[0] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<string>(options, info0);
 
                var info1 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<global::System.Xml.Linq.XNamespace>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::System.Xml.Linq.XName),
                    Converter = null,
                    Getter = static obj => ((global::System.Xml.Linq.XName)obj).Namespace,
                    Setter = null,
                    IgnoreCondition = null,
                    HasJsonInclude = false,
                    IsExtensionData = false,
                    NumberHandling = null,
                    PropertyName = "Namespace",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::System.Xml.Linq.XName).GetProperty("Namespace", InstanceMemberBindingFlags, null, typeof(global::System.Xml.Linq.XNamespace), global::System.Array.Empty<global::System.Type>(), null),
                };
                
                properties[1] = global::System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreatePropertyInfo<global::System.Xml.Linq.XNamespace>(options, info1);
 
                var info2 = new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues<string>
                {
                    IsProperty = true,
                    IsPublic = true,
                    IsVirtual = false,
                    DeclaringType = typeof(global::System.Xml.Linq.XName),
                    Converter = null,
                    Getter = static obj => ((global::System.Xml.Linq.XName)obj).NamespaceName,
                    Setter = null,
                    IgnoreCondition = null,
                    HasJsonInclude = false,
                    IsExtensionData = false,
                    NumberHandling = null,
                    PropertyName = "NamespaceName",
                    JsonPropertyName = null,
                    AttributeProviderFactory = static () => typeof(global::System.Xml.Linq.XName).GetProperty("NamespaceName", 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);
 
                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 XNameSerializeHandler(global::System.Text.Json.Utf8JsonWriter writer, global::System.Xml.Linq.XName? value)
            {
                if (value is null)
                {
                    writer.WriteNullValue();
                    return;
                }
                
                writer.WriteStartObject();
 
                writer.WriteString(PropName_LocalName, ((global::System.Xml.Linq.XName)value).LocalName);
                writer.WritePropertyName(PropName_Namespace);
                XNamespaceSerializeHandler(writer, ((global::System.Xml.Linq.XName)value).Namespace);
                writer.WriteString(PropName_NamespaceName, ((global::System.Xml.Linq.XName)value).NamespaceName);
 
                writer.WriteEndObject();
            }
        }
    }
}