From fedf178a40ccb04b5fd59d4a1b82c26435265cd1 Mon Sep 17 00:00:00 2001 From: Abhipsa Misra Date: Fri, 19 Mar 2021 14:59:35 -0700 Subject: [PATCH] Revert "feature(device-client): Make the DeviceClient and ModuleClient extensible (#1802)" This reverts commit e499b17832cae8c231218e269f8c27666e29bdcc. --- iothub/device/src/DeviceClient.cs | 22 ++-------------------- iothub/device/src/ModuleClient.cs | 22 ++-------------------- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/iothub/device/src/DeviceClient.cs b/iothub/device/src/DeviceClient.cs index 57e91e77a2..43966a49c6 100644 --- a/iothub/device/src/DeviceClient.cs +++ b/iothub/device/src/DeviceClient.cs @@ -15,7 +15,7 @@ namespace Microsoft.Azure.Devices.Client /// Contains methods that a device can use to send messages to and receive from the service. /// /// - public class DeviceClient : IDisposable + public sealed class DeviceClient : IDisposable { /// /// Default operation timeout. @@ -608,25 +608,7 @@ public void SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler sta /// /// Releases the unmanaged resources used by the DeviceClient and optionally disposes of the managed resources. /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases the unmanaged resources used by the DeviceClient and allows for any derived class to override and - /// provide custom implementation. - /// - /// Setting to true will release both managed and unmanaged resources. - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - InternalClient?.Dispose(); - InternalClient = null; - } - } + public void Dispose() => InternalClient?.Dispose(); /// /// Set a callback that will be called whenever the client receives a state update diff --git a/iothub/device/src/ModuleClient.cs b/iothub/device/src/ModuleClient.cs index aee3b0a706..901a84d57e 100644 --- a/iothub/device/src/ModuleClient.cs +++ b/iothub/device/src/ModuleClient.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Devices.Client /// /// Contains methods that a module can use to send messages to and receive from the service and interact with module twins. /// - public class ModuleClient : IDisposable + public sealed class ModuleClient : IDisposable { private const string ModuleMethodUriFormat = "/twins/{0}/modules/{1}/methods?" + ClientApiVersionHelper.ApiVersionQueryStringLatest; private const string DeviceMethodUriFormat = "/twins/{0}/methods?" + ClientApiVersionHelper.ApiVersionQueryStringLatest; @@ -433,25 +433,7 @@ public void SetConnectionStatusChangesHandler(ConnectionStatusChangesHandler sta /// /// Releases the unmanaged resources used by the ModuleClient and optionally disposes of the managed resources. /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases the unmanaged resources used by the ModuleClient and allows for any derived class to override and - /// provide custom implementation. - /// - /// Setting to true will release both managed and unmanaged resources. - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - InternalClient?.Dispose(); - InternalClient = null; - } - } + public void Dispose() => InternalClient?.Dispose(); /// /// Set a callback that will be called whenever the client receives a state update