File: Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\BuildMetadataExtensions.g.cs
Project: ..\..\..\test\Generators\Microsoft.Gen.BuildMetadata\Unit\Microsoft.Gen.BuildMetadata.Unit.Tests.csproj (Microsoft.Gen.BuildMetadata.Unit.Tests)

// <auto-generated/>
#nullable enable
namespace Microsoft.Extensions.AmbientMetadata
{
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Gen.BuildMetadata", "10.9.0.0")]
    internal static class BuildMetadataGeneratedExtensions
    {
        private const string DefaultSectionName = "ambientmetadata:build";
 
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Gen.BuildMetadata", "10.9.0.0")]
        [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
        private sealed class BuildMetadataSource : global::Microsoft.Extensions.Configuration.IConfigurationSource
        {
            public string SectionName { get; }
 
            public BuildMetadataSource(string sectionName)
            {
#if !NET
                if (string.IsNullOrWhiteSpace(sectionName))
                {
                    if (sectionName is null)
                    {
                        throw new global::System.ArgumentNullException(nameof(sectionName));
                    }
 
                    throw new global::System.ArgumentException("The value cannot be an empty string or composed entirely of whitespace.", nameof(sectionName));
                }
#else
                global::System.ArgumentException.ThrowIfNullOrWhiteSpace(sectionName);
#endif
 
                SectionName = sectionName;
            }
 
            public global::Microsoft.Extensions.Configuration.IConfigurationProvider Build(global::Microsoft.Extensions.Configuration.IConfigurationBuilder builder)
            {
                return new global::Microsoft.Extensions.Configuration.Memory.MemoryConfigurationProvider(new global::Microsoft.Extensions.Configuration.Memory.MemoryConfigurationSource())
                {
                    { $"{SectionName}:buildid", "" },
                    { $"{SectionName}:buildnumber", "" },
                    { $"{SectionName}:sourcebranchname", "" },
                    { $"{SectionName}:sourceversion", "" },
                };
            }
        }
 
        public static global::Microsoft.Extensions.Hosting.IHostBuilder UseBuildMetadata(this global::Microsoft.Extensions.Hosting.IHostBuilder builder, string sectionName = DefaultSectionName)
        {
#if !NET
            if (builder is null)
            {
                throw new global::System.ArgumentNullException(nameof(builder));
            }
 
            if (string.IsNullOrWhiteSpace(sectionName))
            {
                if (sectionName is null)
                {
                    throw new global::System.ArgumentNullException(nameof(sectionName));
                }
 
                throw new global::System.ArgumentException("The value cannot be an empty string or composed entirely of whitespace.", nameof(sectionName));
            }
#else
            global::System.ArgumentNullException.ThrowIfNull(builder);
            global::System.ArgumentException.ThrowIfNullOrWhiteSpace(sectionName);
#endif
 
            _ = builder.ConfigureHostConfiguration(configBuilder => configBuilder.AddBuildMetadata(sectionName))
                .ConfigureServices((hostBuilderContext, serviceCollection) =>
                    global::Microsoft.Extensions.DependencyInjection.BuildMetadataServiceCollectionExtensions.AddBuildMetadata(serviceCollection, hostBuilderContext.Configuration.GetSection(sectionName)));
 
            return builder;
        }
 
        public static TBuilder UseBuildMetadata<TBuilder>(this TBuilder builder, string sectionName = DefaultSectionName)
            where TBuilder : global::Microsoft.Extensions.Hosting.IHostApplicationBuilder
        {
#if !NET
            if (builder is null)
            {
                throw new global::System.ArgumentNullException(nameof(builder));
            }
 
            if (string.IsNullOrWhiteSpace(sectionName))
            {
                if (sectionName is null)
                {
                    throw new global::System.ArgumentNullException(nameof(sectionName));
                }
 
                throw new global::System.ArgumentException("The value cannot be an empty string or composed entirely of whitespace.", nameof(sectionName));
            }
#else
            global::System.ArgumentNullException.ThrowIfNull(builder);
            global::System.ArgumentException.ThrowIfNullOrWhiteSpace(sectionName);
#endif
 
            _ = builder.Configuration.AddBuildMetadata(sectionName);
            global::Microsoft.Extensions.DependencyInjection.BuildMetadataServiceCollectionExtensions.AddBuildMetadata(builder.Services, builder.Configuration.GetSection(sectionName));
 
            return builder;
        }
 
        public static global::Microsoft.Extensions.Configuration.IConfigurationBuilder AddBuildMetadata(this global::Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string sectionName = DefaultSectionName)
        {
#if !NET
            if (builder is null)
            {
                throw new global::System.ArgumentNullException(nameof(builder));
            }
 
            if (string.IsNullOrWhiteSpace(sectionName))
            {
                if (sectionName is null)
                {
                    throw new global::System.ArgumentNullException(nameof(sectionName));
                }
 
                throw new global::System.ArgumentException("The value cannot be an empty string or composed entirely of whitespace.", nameof(sectionName));
            }
#else
            global::System.ArgumentNullException.ThrowIfNull(builder);
            global::System.ArgumentException.ThrowIfNullOrWhiteSpace(sectionName);
#endif
 
            return builder.Add(new BuildMetadataSource(sectionName));
        }
    }
}