From c9fea85681069a29ba1b5efcf779de5445ffdc63 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:53:23 +0000 Subject: [PATCH 1/5] Initial plan From ce3c406c973fd3593fd75d8971b3ad03005fe776 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:59:10 +0000 Subject: [PATCH 2/5] Honor custom code property renames in ClientSettings BindCore Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- .../src/Providers/ClientSettingsProvider.cs | 102 ++++++++++++------ 1 file changed, 67 insertions(+), 35 deletions(-) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 0a9d01ecea5..3244161b1ef 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -163,13 +163,13 @@ protected override MethodProvider[] BuildMethods() if (EndpointProperty != null) { - AppendBindingForProperty(body, sectionParam, EndpointProperty.Name, EndpointProperty.Name.ToVariableName(), EndpointProperty.Type); + AppendBindingForProperty(body, sectionParam, GetSettingPropertyName(EndpointProperty.Name), EndpointProperty.Name.ToVariableName(), EndpointProperty.Type, EndpointProperty.Name); } foreach (var param in OtherRequiredParams) { var propName = param.Name.ToIdentifierName(); - AppendBindingForProperty(body, sectionParam, propName, param.Name.ToVariableName(), param.Type); + AppendBindingForProperty(body, sectionParam, GetSettingPropertyName(propName), param.Name.ToVariableName(), param.Type, propName); } // Bind custom constructor parameters from custom code. @@ -212,7 +212,7 @@ protected override MethodProvider[] BuildMethods() var clientOptions = _clientProvider.EffectiveClientOptions; if (clientOptions != null) { - AppendComplexObjectBinding(body, sectionParam, "Options", "options", clientOptions.Type); + AppendComplexObjectBinding(body, sectionParam, GetSettingPropertyName("Options"), "options", clientOptions.Type, "Options"); } var bindCoreMethod = new MethodProvider( @@ -229,6 +229,28 @@ protected override MethodProvider[] BuildMethods() return [bindCoreMethod]; } + /// + /// Resolves the effective property name to assign to during binding, honoring custom code + /// replacements (e.g., a property renamed via [CodeGenMember("OriginalName")]). + /// The configuration key used to read the value remains the original generated name. + /// + private string GetSettingPropertyName(string generatedName) + { + var customProperties = CustomCodeView?.Properties; + if (customProperties != null) + { + foreach (var customProperty in customProperties) + { + if (customProperty.OriginalName == generatedName) + { + return customProperty.Name; + } + } + } + + return generatedName; + } + /// /// Dispatches to the appropriate binding method based on the property type. /// @@ -237,8 +259,11 @@ internal static void AppendBindingForProperty( ParameterProvider sectionParam, string propName, string varName, - CSharpType type) + CSharpType type, + string? configKey = null) { + configKey ??= propName; + // Handle non-framework types (enums, complex objects) if (!type.IsFrameworkType) { @@ -246,11 +271,11 @@ internal static void AppendBindingForProperty( { if (type.IsStruct) { - AppendEnumBinding(body, sectionParam, propName, varName, type); + AppendEnumBinding(body, sectionParam, propName, varName, type, configKey); } else { - AppendFixedEnumBinding(body, sectionParam, propName, varName, type); + AppendFixedEnumBinding(body, sectionParam, propName, varName, type, configKey); } } else if (type.IsStruct && TryGetStructUnderlyingType(type) is { } underlyingType) @@ -259,24 +284,24 @@ internal static void AppendBindingForProperty( // Use the constructor's parameter type to pick the correct binding. if (underlyingType.FrameworkType == typeof(string)) { - AppendEnumBinding(body, sectionParam, propName, varName, type); + AppendEnumBinding(body, sectionParam, propName, varName, type, configKey); } else if (underlyingType.FrameworkType == typeof(int) || underlyingType.FrameworkType == typeof(long)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int), configKey); } else if (underlyingType.FrameworkType == typeof(float) || underlyingType.FrameworkType == typeof(double)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(double)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(double), configKey); } else { - AppendComplexObjectBinding(body, sectionParam, propName, varName, type); + AppendComplexObjectBinding(body, sectionParam, propName, varName, type, configKey); } } else { - AppendComplexObjectBinding(body, sectionParam, propName, varName, type); + AppendComplexObjectBinding(body, sectionParam, propName, varName, type, configKey); } return; } @@ -284,7 +309,7 @@ internal static void AppendBindingForProperty( // Handle collection types (string[]/List) if (type.IsList) { - AppendStringListBinding(body, sectionParam, propName, varName, type); + AppendStringListBinding(body, sectionParam, propName, varName, type, configKey); return; } @@ -292,39 +317,39 @@ internal static void AppendBindingForProperty( if (frameworkType == typeof(string)) { - AppendStringBinding(body, sectionParam, propName, varName); + AppendStringBinding(body, sectionParam, propName, varName, configKey); } else if (frameworkType == typeof(bool)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(bool)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(bool), configKey); } else if (frameworkType == typeof(int)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(int), configKey); } else if (frameworkType == typeof(long)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(long)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(long), configKey); } else if (frameworkType == typeof(float)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(float)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(float), configKey); } else if (frameworkType == typeof(double)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(double)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(double), configKey); } else if (frameworkType == typeof(TimeSpan)) { - AppendTryParseBinding(body, sectionParam, propName, varName, typeof(TimeSpan)); + AppendTryParseBinding(body, sectionParam, propName, varName, typeof(TimeSpan), configKey); } else if (frameworkType == typeof(Uri)) { - AppendUriTryCreateBinding(body, sectionParam, propName, varName); + AppendUriTryCreateBinding(body, sectionParam, propName, varName, configKey); } else { - AppendComplexObjectBinding(body, sectionParam, propName, varName, type); + AppendComplexObjectBinding(body, sectionParam, propName, varName, type, configKey); } } @@ -335,9 +360,10 @@ internal static void AppendStringBinding( List body, ParameterProvider sectionParam, string propName, - string varName) + string varName, + string? configKey = null) { - body.Add(Declare(varName, new CSharpType(typeof(string), isNullable: true), new IndexerExpression(sectionParam, Literal(propName)), out var valVar)); + body.Add(Declare(varName, new CSharpType(typeof(string), isNullable: true), new IndexerExpression(sectionParam, Literal(configKey ?? propName)), out var valVar)); var ifStatement = new IfStatement(Not(StringSnippets.IsNullOrEmpty(valVar.As()))); ifStatement.Add(This.Property(propName).Assign(valVar).Terminate()); body.Add(ifStatement); @@ -351,13 +377,14 @@ internal static void AppendTryParseBinding( ParameterProvider sectionParam, string propName, string varName, - Type parseType) + Type parseType, + string? configKey = null) { var outDecl = new DeclarationExpression(parseType, varName, out var parsedVar, isOut: true); var ifStatement = new IfStatement(Static(parseType).Invoke("TryParse", new ValueExpression[] { - new IndexerExpression(sectionParam, Literal(propName)), + new IndexerExpression(sectionParam, Literal(configKey ?? propName)), outDecl })); ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); @@ -371,13 +398,14 @@ internal static void AppendUriTryCreateBinding( List body, ParameterProvider sectionParam, string propName, - string varName) + string varName, + string? configKey = null) { var outUriDecl = new DeclarationExpression(typeof(Uri), varName, out var uriVar, isOut: true); var ifStatement = new IfStatement(Static(typeof(Uri)).Invoke("TryCreate", new ValueExpression[] { - new IndexerExpression(sectionParam, Literal(propName)), + new IndexerExpression(sectionParam, Literal(configKey ?? propName)), new MemberExpression(typeof(UriKind), nameof(UriKind.Absolute)), outUriDecl })); @@ -394,7 +422,8 @@ internal static void AppendStringListBinding( ParameterProvider sectionParam, string propName, string varName, - CSharpType type) + CSharpType type, + string? configKey = null) { // Only handle List for now if (type.Arguments.Count == 0 || @@ -405,7 +434,7 @@ internal static void AppendStringListBinding( } // IConfigurationSection listSection = section.GetSection("PropName"); - body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(propName)), out var sectionVar)); + body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(configKey ?? propName)), out var sectionVar)); // if (listSection.Exists()) var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); @@ -437,10 +466,11 @@ internal static void AppendEnumBinding( ParameterProvider sectionParam, string propName, string varName, - CSharpType type) + CSharpType type, + string? configKey = null) { var decl = Declare(varName, new CSharpType(typeof(string)), out var declVar); - var ifStatement = new IfStatement(new IndexerExpression(sectionParam, Literal(propName)).Is(decl)); + var ifStatement = new IfStatement(new IndexerExpression(sectionParam, Literal(configKey ?? propName)).Is(decl)); ifStatement.Add(This.Property(propName).Assign(New.Instance(type, declVar)).Terminate()); body.Add(ifStatement); } @@ -453,13 +483,14 @@ internal static void AppendFixedEnumBinding( ParameterProvider sectionParam, string propName, string varName, - CSharpType type) + CSharpType type, + string? configKey = null) { var outDecl = new DeclarationExpression(type, varName, out var parsedVar, isOut: true); var ifStatement = new IfStatement(Static(typeof(Enum)).Invoke("TryParse", new ValueExpression[] { - new IndexerExpression(sectionParam, Literal(propName)), + new IndexerExpression(sectionParam, Literal(configKey ?? propName)), outDecl })); ifStatement.Add(This.Property(propName).Assign(parsedVar).Terminate()); @@ -475,10 +506,11 @@ internal static void AppendComplexObjectBinding( ParameterProvider sectionParam, string propName, string varName, - CSharpType type) + CSharpType type, + string? configKey = null) { // IConfigurationSection {name}Section = section.GetSection("PropName"); - body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(propName)), out var sectionVar)); + body.Add(Declare((propName + "Section").ToVariableName(), IConfigurationSectionType, sectionParam.Invoke("GetSection", Literal(configKey ?? propName)), out var sectionVar)); // if ({name}Section.Exists()) { PropName = new TypeName({name}Section); } var ifExistsStatement = new IfStatement(sectionVar.Invoke("Exists")); From ab04297527a5edf352083b93430ca6818192e61f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 18:02:25 +0000 Subject: [PATCH 3/5] Add test and changeset for ClientSettings custom rename Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- ...settings-custom-rename-2026-6-5-17-55-0.md | 7 +++ .../Providers/ClientSettingsProviderTests.cs | 44 +++++++++++++++++++ .../TestClientSettings.cs | 13 ++++++ 3 files changed, 64 insertions(+) create mode 100644 .chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename/TestClientSettings.cs diff --git a/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md b/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md new file mode 100644 index 00000000000..c928a1b38bc --- /dev/null +++ b/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-csharp" +--- + +Honor custom code property replacements (e.g. `[CodeGenMember("Url")]`) in the generated `ClientSettings.BindCore` method so the binding assigns to the renamed property while still reading from the original configuration key. diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index 11e6552c047..ca98c5254d1 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -1140,5 +1140,49 @@ await MockHelpers.LoadMockGeneratorAsync( Assert.IsTrue(bodyString.Contains("TenantId"), "BindCore should bind the non-credential parameter 'TenantId'"); } + + [Test] + public async Task TestBindCoreMethod_HonorsCustomPropertyRename() + { + // Custom code renames the generated 'Endpoint' settings property to 'ServiceUri' + // via [CodeGenMember("Endpoint")]. BindCore should assign to the renamed property + // while still reading from the original configuration key. + await MockHelpers.LoadMockGeneratorAsync( + compilation: async () => await Helpers.GetCompilationFromDirectoryAsync()); + + var inputParameters = new[] + { + InputFactory.EndpointParameter( + "endpoint", + InputPrimitiveType.Url, + scope: InputParameterScope.Client, + isEndpoint: true) + }; + var client = InputFactory.Client("TestClient", clientNamespace: "SampleNamespace", parameters: inputParameters); + var clientProvider = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(client); + Assert.IsNotNull(clientProvider); + + var settingsProvider = clientProvider!.ClientSettings; + Assert.IsNotNull(settingsProvider); + Assert.IsNotNull(settingsProvider!.CustomCodeView, + "CustomCodeView should be available from the compilation"); + + // The generated 'Endpoint' property should be replaced by the custom 'ServiceUri' property. + Assert.IsNull(settingsProvider.Properties.FirstOrDefault(p => p.Name == "Endpoint"), + "Generated 'Endpoint' property should be replaced by the custom code rename"); + + var bindCoreMethod = settingsProvider.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); + Assert.IsNotNull(bindCoreMethod); + + var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); + // Assignment target should be the renamed property. + Assert.IsTrue(bodyString.Contains("ServiceUri = "), + "BindCore should assign to the renamed 'ServiceUri' property"); + Assert.IsFalse(bodyString.Contains("this.Endpoint = ") || bodyString.Contains("Endpoint = endpoint"), + "BindCore should not assign to the original 'Endpoint' property after the custom rename"); + // Configuration key should remain the original generated name. + Assert.IsTrue(bodyString.Contains("section[\"Endpoint\"]"), + "BindCore should still read from the original 'Endpoint' configuration key"); + } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename/TestClientSettings.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename/TestClientSettings.cs new file mode 100644 index 00000000000..313c84ba6d1 --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename/TestClientSettings.cs @@ -0,0 +1,13 @@ +#nullable disable + +using System; +using Microsoft.TypeSpec.Generator.Customizations; + +namespace SampleNamespace +{ + public partial class TestClientSettings + { + [CodeGenMember("Endpoint")] + public Uri ServiceUri { get; set; } + } +} From 59ef196945a7f1f497ad621feb4add9d8180f261 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 18:13:05 +0000 Subject: [PATCH 4/5] Use CanonicalView for property lookup and remove changeset Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- ...r-client-settings-custom-rename-2026-6-5-17-55-0.md | 7 ------- .../src/Providers/ClientSettingsProvider.cs | 10 +++------- 2 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 .chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md diff --git a/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md b/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md deleted file mode 100644 index c928a1b38bc..00000000000 --- a/.chronus/changes/honor-client-settings-custom-rename-2026-6-5-17-55-0.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: fix -packages: - - "@typespec/http-client-csharp" ---- - -Honor custom code property replacements (e.g. `[CodeGenMember("Url")]`) in the generated `ClientSettings.BindCore` method so the binding assigns to the renamed property while still reading from the original configuration key. diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs index 3244161b1ef..160d63a3363 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ClientSettingsProvider.cs @@ -236,15 +236,11 @@ protected override MethodProvider[] BuildMethods() /// private string GetSettingPropertyName(string generatedName) { - var customProperties = CustomCodeView?.Properties; - if (customProperties != null) + foreach (var property in CanonicalView.Properties) { - foreach (var customProperty in customProperties) + if (property.OriginalName == generatedName) { - if (customProperty.OriginalName == generatedName) - { - return customProperty.Name; - } + return property.Name; } } From eccc8c481ddaa651dcd10059cad255e1b9088ade Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Jun 2026 19:28:07 +0000 Subject: [PATCH 5/5] Validate custom rename BindCore against TestData expected file Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com> --- .../Providers/ClientSettingsProviderTests.cs | 14 ++++----- ...ndCoreMethod_HonorsCustomPropertyRename.cs | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename.cs diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs index ca98c5254d1..c8768a0ab79 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/ClientSettingsProviderTests.cs @@ -1174,15 +1174,11 @@ await MockHelpers.LoadMockGeneratorAsync( var bindCoreMethod = settingsProvider.Methods.FirstOrDefault(m => m.Signature.Name == "BindCore"); Assert.IsNotNull(bindCoreMethod); - var bodyString = bindCoreMethod!.BodyStatements!.ToDisplayString(); - // Assignment target should be the renamed property. - Assert.IsTrue(bodyString.Contains("ServiceUri = "), - "BindCore should assign to the renamed 'ServiceUri' property"); - Assert.IsFalse(bodyString.Contains("this.Endpoint = ") || bodyString.Contains("Endpoint = endpoint"), - "BindCore should not assign to the original 'Endpoint' property after the custom rename"); - // Configuration key should remain the original generated name. - Assert.IsTrue(bodyString.Contains("section[\"Endpoint\"]"), - "BindCore should still read from the original 'Endpoint' configuration key"); + // Validate full generated output: BindCore should assign to the renamed 'ServiceUri' + // property while still reading from the original 'Endpoint' configuration key. + var writer = new TypeProviderWriter(settingsProvider); + var file = writer.Write(); + Assert.AreEqual(Helpers.GetExpectedFromFile(), file.Content); } } } diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename.cs new file mode 100644 index 00000000000..93ac5b7e27b --- /dev/null +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/test/Providers/TestData/ClientSettingsProviderTests/TestBindCoreMethod_HonorsCustomPropertyRename.cs @@ -0,0 +1,30 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace SampleNamespace +{ + [global::System.Diagnostics.CodeAnalysis.ExperimentalAttribute("SCME0002")] + public partial class TestClientSettings : global::System.ClientModel.Primitives.ClientSettings + { + public global::SampleNamespace.TestClientOptions Options { get; set; } + + protected override void BindCore(global::Microsoft.Extensions.Configuration.IConfigurationSection section) + { + if (global::System.Uri.TryCreate(section["Endpoint"], global::System.UriKind.Absolute, out global::System.Uri endpoint)) + { + this.ServiceUri = endpoint; + } + global::Microsoft.Extensions.Configuration.IConfigurationSection optionsSection = section.GetSection("Options"); + if (optionsSection.Exists()) + { + this.Options = new global::SampleNamespace.TestClientOptions(optionsSection); + } + } + } +}