Copied to clipboard

Flag this post as spam?

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


  • kristian schneider 190 posts 351 karma points
    Dec 19, 2011 @ 13:02
    kristian schneider
    0

    linq2umbraco umbracodatacontext does not get updated

    Hi.

    I'm using the umbracodatacontext provider to do some linq stuff.

    However I am having problems with the umbracodatacontext not beeing updated after I delete a node.

    I have the following simple code that gets some data from the context:

     

    using (var ctx = Backend.DomainModel.UmbracoObjects.MyUmbracoContextDataContext.Instance)
                {
                    glhRepeater.DataSource = (from glh in ctx.GuidedLearningHours where glh.Client == currentId select glh);
                    glhRepeater.DataBind();
                }

     

    This code is called during pageload and thats fine.

    I then delete one of the GuidedLearninghours nodes via "regular" umbraco calls in this manner:

     public void deleteGlh(int id)
            {
                var u = User.GetUser(0);
                var d = new Document(id);
                d.delete();
                if (d.Published)
                {
                    d.UnPublish();
                    umbraco.library.UnPublishSingleNode(d.Id);
                }
                d.delete();
                umbraco.library.UpdateDocumentCache(d.Id);
            }

    and then subsequently I run the previous code to populate my repeater. But the newly delete node is still there.

    Now I have checked that I get a new umbracodatacontext since the old is removed from cache when the delete event is fired. I also tried to dispose the umbracodatacontext without luck.

    I have a suspission that it is related to the umbraco.config file somehow not beeing updated.

    Any sugestions? 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 19, 2011 @ 13:22
    Jeroen Breuer
    0

    Perhaps this topic can give you more info about the problem: http://our.umbraco.org/forum/developers/api-questions/14672-don't-get-my-node-back-with-linq-after-responseredirect.

    Jeroen

  • kristian schneider 190 posts 351 karma points
    Dec 19, 2011 @ 13:45
    kristian schneider
    0

    This it definetly seem to be related to that. Did no one newer find a fix or workaround for it?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 19, 2011 @ 13:48
    Jeroen Breuer
    0

    Unfortuanlty I never found a solution for this. I just stopped using linq2umbraco, because it was getting slow with 2000+ nodes.

    Jeroen

  • kristian schneider 190 posts 351 karma points
    Dec 19, 2011 @ 15:27
    kristian schneider
    0

    damint #H5IS 

    I called  d.delete();

    before I did all the rest and that screwed it up

Please Sign in or register to post replies

Write your reply to:

Draft