37 references to OutLn
Microsoft.Gen.BuildMetadata (37)
Emitter.cs (34)
37
OutLn
("[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]");
38
OutLn
($"private sealed class BuildMetadataSource : {ConfigurationNamespace}IConfigurationSource");
41
OutLn
("public string SectionName { get; }");
44
OutLn
("public BuildMetadataSource(string sectionName)");
48
OutLn
("SectionName = sectionName;");
53
OutLn
($"public {ConfigurationNamespace}IConfigurationProvider Build({ConfigurationNamespace}IConfigurationBuilder builder)");
56
OutLn
($"return new {ConfigurationNamespace}Memory.MemoryConfigurationProvider(new {ConfigurationNamespace}Memory.MemoryConfigurationSource())");
59
OutLn
($$"""{ $"{SectionName}:buildid", "{{_buildId}}" },""");
60
OutLn
($$"""{ $"{SectionName}:buildnumber", "{{_buildNumber}}" },""");
61
OutLn
($$"""{ $"{SectionName}:sourcebranchname", "{{_sourceBranchName}}" },""");
62
OutLn
($$"""{ $"{SectionName}:sourceversion", "{{_sourceVersion}}" },""");
76
OutLn
("namespace Microsoft.Extensions.AmbientMetadata");
80
OutLn
("internal static class BuildMetadataGeneratedExtensions");
83
OutLn
("private const string DefaultSectionName = \"ambientmetadata:build\";");
89
OutLn
($"public static {HostingNamespace}IHostBuilder UseBuildMetadata(this {HostingNamespace}IHostBuilder builder, string sectionName = DefaultSectionName)");
93
OutLn
("_ = builder.ConfigureHostConfiguration(configBuilder => configBuilder.AddBuildMetadata(sectionName))");
95
OutLn
(".ConfigureServices((hostBuilderContext, serviceCollection) =>");
97
OutLn
($"{DependencyInjectionNamespace}BuildMetadataServiceCollectionExtensions.AddBuildMetadata(serviceCollection, hostBuilderContext.Configuration.GetSection(sectionName)));");
102
OutLn
("return builder;");
108
OutLn
("public static TBuilder UseBuildMetadata<TBuilder>(this TBuilder builder, string sectionName = DefaultSectionName)");
110
OutLn
($"where TBuilder : {HostingNamespace}IHostApplicationBuilder");
115
OutLn
("_ = builder.Configuration.AddBuildMetadata(sectionName);");
116
OutLn
($"{DependencyInjectionNamespace}BuildMetadataServiceCollectionExtensions.AddBuildMetadata(builder.Services, builder.Configuration.GetSection(sectionName));");
119
OutLn
("return builder;");
126
OutLn
($"public static {ConfigurationNamespace}IConfigurationBuilder AddBuildMetadata(this {ConfigurationNamespace}IConfigurationBuilder builder, string sectionName = DefaultSectionName)");
131
OutLn
("return builder.Add(new BuildMetadataSource(sectionName));");
149
OutLn
("if (builder is null)");
151
OutLn
("throw new global::System.ArgumentNullException(nameof(builder));");
156
OutLn
("if (string.IsNullOrWhiteSpace(sectionName))");
159
OutLn
("if (sectionName is null)");
162
OutLn
("throw new global::System.ArgumentNullException(nameof(sectionName));");
167
OutLn
("throw new global::System.ArgumentException(\"The value cannot be an empty string or composed entirely of whitespace.\", nameof(sectionName));");
176
OutLn
("global::System.ArgumentNullException.ThrowIfNull(builder);");
179
OutLn
("global::System.ArgumentException.ThrowIfNullOrWhiteSpace(sectionName);");
src\Generators\Shared\EmitterBase.cs (3)
39
OutLn
("{");
46
OutLn
("}");
103
protected void OutGeneratedCodeAttribute() =>
OutLn
($"[{GeneratorUtilities.GeneratedCodeAttribute}]");