diff --git a/src/SDKs/RecoveryServices/Management.RecoveryServices/Customizations/RecoveryServicesClient.cs b/src/SDKs/RecoveryServices/Management.RecoveryServices/Customizations/RecoveryServicesClient.cs index db2a6433f0ab6..0a4a845e14db0 100644 --- a/src/SDKs/RecoveryServices/Management.RecoveryServices/Customizations/RecoveryServicesClient.cs +++ b/src/SDKs/RecoveryServices/Management.RecoveryServices/Customizations/RecoveryServicesClient.cs @@ -11,7 +11,7 @@ namespace Microsoft.Azure.Management.RecoveryServices { public partial class RecoveryServicesClient { - bool DisableDispose { get; set; } + public bool DisableDispose { get; set; } = false; protected RecoveryServicesClient(HttpClient httpClient, params DelegatingHandler[] handlers) { @@ -39,9 +39,14 @@ public RecoveryServicesClient(System.Uri baseUri, ServiceClientCredentials crede DisableDispose = disableDispose; } + public void SetHttpClient(HttpClient client) + { + HttpClient = client; + } + protected override void Dispose(bool disposing) { - if (DisableDispose) + if (!DisableDispose) { base.Dispose(disposing); }