When working with multiple client object-containers each container has its own reference cache. When you query for objects, you get always the cached objects. This means, that objects probably have been updated in the mean-time but the client still sees the old state.
For some scenarios you might need to refresh to objects to bring it up to date. There are two strategies for this. You can explicit refresh a object at any time. Or you can use callbacks to refresh object on each commit. Both methods have their advantage.
Explicit Refreshing | Using Callbacks | |
Advantage |
|
|
Disadvantage |
|
|
You can refresh objects with the refresh-method on the object-container. The pass the object to refresh and the refresh-depth to the method:
db.Ext().Refresh(objToRefresh, int.MaxValue);
db.Ext().Refresh(objToRefresh, Integer.MaxValue)
You can use the committed-event to refresh objects as soon as another client commits. Take a look at the example: See "Committed Event Example"