Copied to clipboard

Flag this post as spam?

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


  • sandiego 2 posts 22 karma points
    May 15, 2012 @ 21:36
    sandiego
    0

    Content initialized (was already in context) after calling umbraco.library.UpdateDocumentCache

    Hi,

    On DebugView app, when I call umbraco.library.UpdateDocumentCache(docID) I get 7,868 lines of "[4868] Content initialized (was already in context)" message. And I think this is odd, I'm expecting just one line of this message displayed. Below is my code and let me know if I'm doing stuff incorrectly.

     

    IEnumerable<Node> allNodes = GetNodes(<DocumentType>);

    if (allNodes != null)  {

           var q = (from b in allNodes where (NodeLibrary.GetNodeProperty(b, "isApproved", "0") == "1") select b);

    //select a random node

            int index = new Random().Next(q.Count());

    Node selectedNode = q.Skip(index).First<Node>();

    if ( selectedNode  != null)

            {

    Document docNode = new Document( selectedNode.Id);

                    docNode.getProperty("selectionDate").Value = DateTime.Now.ToString("yyyy-MM-dd");

                    docNode.Publish(User.GetUser(0));

                    umbraco.library.UpdateDocumentCache(docNode.Id);

    }

    }                 

     

Please Sign in or register to post replies

Write your reply to:

Draft