chore: remove unecessary dispose logic, instantiate services inline #633
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After much research (online articles, consulting AI, reviewing other large client libraries that don't use it), I determined the
disposelogic is not necessary. The C# HTTP client under the hood handles its own dispose and our service objects are not large enough to warrant any real memory issues. A lot of this was noise and most likely did not have a meaningful improvement on memory management.Separately, the client service instantiation was moved inline to reduce complexity as it was also determined that instantiating them in the constructor vs inline had no real performance implications.
Finally, I fixed the added but yet released
RetrieveBatchfunction to use the parameter set instead of a dictionary. We are moving to have this library only support parameter sets moving forward (eg: ClaimService) which is the newest service added does not have any functions that accept a dictionary, so adjusted the parameter definition.Finally finally... fixes a nasty compiler error with the
Dictionariesfile I had to track down.Testing
Tests pass and re-recorded the new retrieve batch cassette verifying that the adjustment to service instantiation works.
Pull Request Type
Please select the option(s) that are relevant to this PR.