Skip to content

Commit a523cfc

Browse files
committed
Revert "Removed app config code from ServiceClientAdapter"
This reverts commit fc38c44.
1 parent 86a1bb5 commit a523cfc

File tree

1 file changed

+10
-1
lines changed
  • src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter

1 file changed

+10
-1
lines changed

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.ServiceClientAdapter/ServiceClientAdapter.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,26 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ServiceClient
2424
{
2525
public partial class ServiceClientAdapter
2626
{
27+
const string AppSettingsSectionName = "appSettings";
2728
const string RecoveryServicesResourceNamespace = "Microsoft.RecoveryServices";
29+
const string ProviderNamespaceKey = "ProviderNamespace";
2830
const string AzureFabricName = "Azure";
2931

3032
ClientProxy<RecoveryServicesNS.RecoveryServicesBackupManagementClient, RecoveryServicesModelsNS.CustomRequestHeaders> BmsAdapter;
3133

3234
public ServiceClientAdapter(SubscriptionCloudCredentials creds, Uri baseUri)
3335
{
36+
System.Configuration.Configuration exeConfiguration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetExecutingAssembly().Location);
37+
System.Configuration.AppSettingsSection appSettings = (System.Configuration.AppSettingsSection)exeConfiguration.GetSection(AppSettingsSectionName);
38+
string recoveryServicesResourceNamespace = RecoveryServicesResourceNamespace;
39+
if (appSettings.Settings[ProviderNamespaceKey] != null)
40+
{
41+
recoveryServicesResourceNamespace = appSettings.Settings[ProviderNamespaceKey].Value;
42+
}
3443
BmsAdapter = new ClientProxy<RecoveryServicesNS.RecoveryServicesBackupManagementClient, RecoveryServicesModelsNS.CustomRequestHeaders>(
3544
clientRequestId => new RecoveryServicesModelsNS.CustomRequestHeaders() { ClientRequestId = clientRequestId },
3645
creds, baseUri);
37-
BmsAdapter.Client.ResourceNamespace = RecoveryServicesResourceNamespace;
46+
BmsAdapter.Client.ResourceNamespace = recoveryServicesResourceNamespace;
3847
}
3948
}
4049
}

0 commit comments

Comments
 (0)