I have a pretty simple question that I cannot find the answer to. I have a silverlight app with Ria services. In the DomainService class, I have an update method as shown below:
public void UpdateConversationState(ConversationState currentConversationState) { var original = ChangeSet.GetOriginal(currentConversationState); if (original != null) ObjectContext.ConversationStatesRepository.AttachAsModified(currentConversationState, original); else ObjectContext.ConversationStatesRepository.Attach(currentConversationState); currentConversationState.UpdDat = DateTime.Now; if(original.Name != currentConversationState.Name)
The problem is that the Name property is always empty. In fact, every field, except for Id, has default values. I tried to find a GetOriginal method, but cannot find any help. It seems that it is trying to restore the original object to the server based on the changes sent from the client to the server.
Or maybe someone knows a better way to check if any property of an object was changed during the update? I could compare it with the value in the database, but it seems to me that I should avoid this extra call to the database.
Any help again is much appreciated :-)
EDIT: Just found out about RoundTripOriginalAttribute. This seems to be a trick. Am I the only one who thinks that the RIA can be documented a little better?
wcf-ria-services changeset domainservices
Sander_v
source share