Cache is Killing Me

Thread is closed for posting
3 posts, 1 answers
  1. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 14 Sep 2011 Link to this post

    Hi there, sorry for the title, but the terrible truth is that my project viability is put to risk and I don't know what to do.

    I'm developing a silverlight application that uses Telerik ORM connected to an Oracle DB.

    I use a Datacontext in my silverlight application and when I access from two debbugable executables I can see that the changes made into any entity are not reflected (refreshed) in the other instance of the application.

    I change a client name, for example, and that changed name is not update in the other application instance.. I do not want to cache my entities.

    How can I disable those cache attributes?

    I've tried several modifications, but I couldn't get the expected result. Please check the attached images and if you can please give me some indications.

    Thanks in advance,
    Nelson
  2. Answer
    Ralph Waldenmaier
    Admin
    Ralph Waldenmaier avatar
    202 posts

    Posted 15 Sep 2011 Link to this post

    Hello Nelson,

    Thank you for the provided screenshots. Without having detailed information about your project, I can imagine, that the behavior belongs to the OpenAccessContext. It looks like that you either don't call the SaveChanges() Method of the Context, which will result in saving all changes to the context and setting the state of the object to hollow(Details about object states can be found here) or you don't create a new OpenAccessContext whenever you are requesting the data. In general it is recommended to have a stateless OpenAccessContext meaning that you are using a using block for the OpenAccessContext whenever you are accessing data. What you can do is the following:
    1. Ensure that the changes are indeed pushed to the database. You can do so by simply doing a query in the database itself and checking if the edited values made it there.
    2. Request the object in your second application from the server again using its ID. This should act as a refresh and it should fix your problem.

    Additionally I would like to point you to our SDK where you can find sample projects for using Telerik OpenAccess ORM in Silverlight environments.

    I hope this information is helpful for you.

    Kind regards,
    Ralph
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

  3. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 21 Sep 2011 Link to this post

    I've resolved it :)

    I wasn't using the LoadBehavior.RefreshCurrent when I was loading my objects from database!

    Thanks
Back to Top