Consider this scenario where the generated Url setting property should be replaced with the one defined in custom code.
// CUSTOM
public partial class QueueClientSettings
{
/// <summary> Gets or sets the Queue Uri. </summary>
[CodeGenMember("Url")]
public Uri QueueUri { get; set; }
}
This leads to code that doesn't compile instead:
// GENERATED
/// <summary> Represents the settings used to configure a <see cref="QueueClient"/> that can be loaded from an <see cref="IConfigurationSection"/>. </summary>
[Experimental("SCME0002")]
public partial class QueueClientSettings : ClientSettings
{
/// <summary> Gets or sets the Options. </summary>
public QueueClientOptions Options { get; set; }
/// <summary> Binds configuration values from the given section. </summary>
/// <param name="section"> The configuration section. </param>
protected override void BindCore(IConfigurationSection section)
{
if (Uri.TryCreate(section["Url"], UriKind.Absolute, out Uri url))
{
this.Url = url;
}
string connectionString = section["ConnectionString"];
if (!string.IsNullOrEmpty(connectionString))
{
ConnectionString = connectionString;
}
string queueName = section["QueueName"];
if (!string.IsNullOrEmpty(queueName))
{
QueueName = queueName;
}
IConfigurationSection optionsSection = section.GetSection("Options");
if (optionsSection.Exists())
{
Options = new QueueClientOptions(optionsSection);
}
}
}
We should honor any custom code replacements done in ClientSettings
Consider this scenario where the generated
Urlsetting property should be replaced with the one defined in custom code.This leads to code that doesn't compile instead:
We should honor any custom code replacements done in ClientSettings