locked
UpdateItem does not update Version Stamp RRS feed

  • Question

  •  

    When I create a new HealthRecordItem using HealthRecordAccessor.NewItem(hvItem),  the Key of hvItem gets updated.

     

    But, on the contrary, when I do an update using HealthRecordAccessor.UpdateItem(hvItem),  the version stamp is not getting updated.   I have to do another seperate HealthRecordAccessor.GetItem(hvItem.Key.Id) and then find the new version stamp.  This is highly inefficient since after each update,  I need to do a Get to obtain the latest version key.  Is this a bug or there is a reason for this behaviour?

     

    When I looked into source code, during UpdateItem,  the version stamp is NOT gettting updated. The code looks something like this.... (Specifically note the section in red, it will be false during update)

     

    Code Snippet

     

    if (flag)
        {
            HealthServiceRequest request = this._connection.CreateRequest(this, "PutThings", 1);
            request.Parameters = output.ToString();
            request.Execute();
            XPathNodeIterator iterator = request.Response.InfoNavigator.Select(GetThingIdXPathExpression(request.Response.InfoNavigator));
            int num = 0;
            foreach (XPathNavigator navigator in iterator)
            {
                HealthRecordItem item2 = itemsToUpdate[num];
                if (item2.Key == null)
                {
                    XPathNavigator navigator2 = navigator.SelectSingleNode("thing-id");
                    item2.Key = new HealthRecordItemKey(new Guid(navigator2.Value), new Guid(navigator2.GetAttribute("version-stamp", string.Empty)));
                }
                item2.ClearDirtyFlags();
                num++;
            }
        }

     

     

    Any explanation highly appreciated.

    Tuesday, November 4, 2008 1:21 PM

Answers

All replies