Refreshing Entities from the data store

I have the following scenario:

I've got an object being passed into a webservice, so it has no state. I know I can iterate through the fields using StateEntry and mark them all as modified and a few other ways, but I wanted to see if refresh would do the trick.

I check the currentvalue and originalvalue of a particular property before doing a refresh.

As expected, they both have the value of the incoming property... e.g. "Julie was here".

Then I do a refresh using ClientWins.

When I check the currentvalue and originalvalue of that particular property after the refresh they are both null (server has a null value).

I expected this to make original value null and leave the current value as "Julie was here" .

I understand that this won't modify the state , but was curious why the current value was overwritten.

thanks

julie

[944 byte] By [JulieLerman] at [2008-1-10]
# 1

If your entity is in the modified state, then the original value should not be overwritten. If it's in the unchanged state, then client wins vs. store wins isn't considered interesting, and refresh will do basically the same thing either time--it updates the current values (which implicitly updates the original values--we just don't store two copies when we know they are the same).

Does that make sense?

- Danny

DanielSimmons-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,ADO.NET Orcas...
# 2

Perfect sense...

My next idea was to try setting it to modified before I did the refresh.. :-)

JulieLerman at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,ADO.NET Orcas...

Visual Studio Orcas

Site Classified