-
Notifications
You must be signed in to change notification settings - Fork 3
cache update: don't replace model. replace resource #36
Copy link
Copy link
Open
Labels
Description
when the basic cache updates a model, it's just overriding any previous model in the cache with that id. this is bad. models may be updated from various apis at various times during a session's lifetime. doing so will mess up any model pointers that haven been returned from the session.
i.e. the reference that was returned from the session is no longer the cached model because it was overwritten by some other caching operation.
instead, the cache should check for the existence of a model and replace its Resource with the one fetched from the server.
this would require a new method be woven into the Model to refresh all the attribute Property values from the newly set Resource.
model.UpdateResource(IResourceIdentifier resource)
{
foreach Property marked as [Property], refresh value from session
}
Reactions are currently unavailable