Looking at your requirements and statements, I made a few assumptions before starting to write my vision about a possible solution:
- You use the same class to retrieve (the return type of the read operation) and update the item (input type of the update operation) in your WCF service.
- Your current implementation problem is how to use the source class (not the dictionary) and still be able to define “what has changed compared to reading” when you get the “Update” operation called by your WCF service
- You are writing a server and a client. Both are written using MS.Net.
If so, the problem is the lack of update information. The necessary information has “changed”, which can be displayed if there is a second state for comparison or should be present next to the state for updating in the background.
Since you only have a “back-end state” (no flags) when the client sends its data to the WCF service, how do we determine what has changed? Obviously, we want to prevent another “read” roundtrip in order to get the current state of the server and start comparing.
Sending the initial and altered state from the client to the server is a possible, but difficult decision. In addition, the client is not interested in this information, the server.
Adding this all guesses that changing the type of the input parameter of the Refresh operation is the easiest way. Create a decorator class that adds the dirty bit behavior to the original entity. Use this new class as an input to the Refresh operation. You will then have availability on the server to check this dirty bit next to the full status message by the client. The main change on the client side is that the object required for the Update operation is no longer the same as that provided by the Read method. To increase this pain, I would probably create a decorator class that added the necessary "dirty bit" processing. This requires only changing the object, supporting the signature of the interface for the client (very few code changes).
source share