Print Page | Close Window

Update from cache

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1979
Printed Date: 26-Apr-2025 at 1:05am


Topic: Update from cache
Posted By: adamh
Subject: Update from cache
Date Posted: 19-Jul-2010 at 6:21pm
In Silverlight how do a get a single entity in the cache to refresh from value on webserver



Replies:
Posted By: davidklitzke
Date Posted: 20-Jul-2010 at 3:00pm
Updating the cache is a pure client-side operation.  It is essentially the same whether you are running a Silverlight, WPF, or WinClient application.  Get the value from webserver and stuff it in the cache.  You should be able to find some examples in the Learning Resources on Disconnected Use,


Posted By: adamh
Date Posted: 20-Jul-2010 at 4:30pm

If I have an instance of an entity Person called ‘person’ on the Silverlight side .. how do I ask it to refresh itself now.

Just that instance.

 

Can't figure it out from the documentation. 

 



Posted By: ting
Date Posted: 20-Jul-2010 at 5:19pm
This is not as obvious as it should be.  We will be reviewing the signatures for RefetchEntitiesAsync.  In the meantime, the code should look like this:
 
      var list = new EntityKeyList(typeof(Person), new EntityKey[] { somePerson.EntityAspect.EntityKey });
      entityManager.RefetchEntitiesAsync(list, MergeStrategy.OverwriteChanges, RefetchCompleted, null);
 
...
 
    void RefetchCompleted(EntityQueryOperation e) {
      // Do stuff
    }
 


Posted By: adamh
Date Posted: 20-Jul-2010 at 5:28pm

lol .. I thought it wasn't straightforward ...




Print Page | Close Window