Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martijn van der Put 44 posts 65 karma points
    Jan 07, 2012 @ 17:13
    Martijn van der Put
    0

    Linq2Umbraco cached DataContext stays empty after import/refresh

    I am using Linq2Umbraco in my project togther with a nightly import of new product items. 

    To gain a performance improvement I used the Cached DataContext as is described in other posts on this forum and in Aaron Powells video about caching.

    I encounter strange behavior that I can't seem to resolve.

    I start my site with a clean cache and no product items. Then I start the import, which imports and publishes a lot of imported product items. When the import is finished, I clear the DataContext cache-key. However, the next time when I request product items from the DataContext, a new DataContext object is created, added to the cache and returned.
    However, this newly created DataContext doesn't contain the newly imported product items (the umbraco.config file is updated before a new DataContext object is created) and since the DataContext is cached I never see my newly imported product items on the website.

    The only way I seem to get the newly imported product items in the DataContext is when I restart the website.

    Anyone any ideas? (I think I'm overlooking something simple but can't seem to figure it out...)

     

Please Sign in or register to post replies

Write your reply to:

Draft