Version stamps on data items…

If you look closely at the HealthRecordItem.Key, you will find that it is of type HealthRecordItemKey. That key has two elements:

Id is a unique identifier for this particular piece of data.

VersionStamp is used to differentiate between different versions of this piece of data.

This is used both to deal with auditing and multiple versions, and also to make sure that any update operations are modifying the most recent version of a data item.

For example, if I have something like this:

Height height = FetchOneHeightItem();

... do some processing, including updating the value in the height


There is a small chance that somebody else has modified that height item between the time I fetched it and the time I went to update it. The system looks at the version stamp on the most recent item it knows about and the one I'm asking to update, and if there is a mismatch, it throws an exception.


If you have code that does updates, it needs to check for HealthServiceException to handle this case.



Comments (1)
  1. If you look closely at the HealthRecordItem.Key , you will find that it is of type HealthRecordItemKey

Comments are closed.

Skip to main content