Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where bundle extension could return null when resource exists #19

Merged
merged 2 commits into from
Jan 3, 2020

Conversation

namalu
Copy link
Member

@namalu namalu commented Jan 3, 2020

A condition exists, where, a search request can return an empty bundle with a continuation token. The ReadOneFromBundle method assumed that if any Resource meeting the search criteria was found, the first bundle returned would contain at least one resource.

These changes include:

  • A fix to ensure the continuation token is respected.
  • Fixes to unit tests so they can be run on Linux and Mac machines.
  • An update to the .gitignore file to ignore Mac OS system files.

@namalu namalu merged commit a9b679a into master Jan 3, 2020
@namalu namalu deleted the personal/namalu/read-one-bundle-fix branch January 3, 2020 21:07

var resources = await bundle?.ReadFromBundleWithContinuationAsync<TResource>(fhirClient, 2);

var resourceCount = resources.Count();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but best to use .ToArray to avoid multiple enumerations over the same collection (happens with Count & FirstOrDefault). Impact is minimal since ReadFromBundleWithContinuation is using a materialized collection behind the scenes (list in this case) but if that ever changes we should re-evaluate.

We also may want to look at using async enumerables going forward as well https://docs.microsoft.com/en-us/archive/msdn-magazine/2019/november/csharp-iterating-with-async-enumerables-in-csharp-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants