akamsteeg / AtleX.HaveIBeenPwned

A fully async .NET Standard client library for the API of HaveIBeenPwned.com
https://www.nuget.org/packages/AtleX.HaveIBeenPwned/
MIT License
5 stars 0 forks source link

Remove IDisposable from IHaveIBeenPwnedClient #10

Closed akamsteeg closed 5 years ago

akamsteeg commented 5 years ago

Currently, in v2.*, IHaveIBeenPwnedClient extends IDisposable. That's not desirable, because it forces any implementation of a custom client to implement the dispose logic too and some might not need it. We can safely remove the interface (it's breaking, so major version bump), and in HaveIBeenPwnedClient.Dispose(bool) only dispose the used IHaveBeenPwnedClient when it's disposable.

Example:

protected override void Dispose(bool disposing)
    {
      if (disposing && this._serviceClient is IDisposable disposableClient)
      {
        disposableClient.Dispose();
      }
    }