+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to remove blog.Posts from cache?

How to remove blog.Posts from cache?

2 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    13 Aug 2010
    Link to this post
    When I make a new post the blog.Posts is not updated, while the database is update...

    Doing

    var posts = (new Telerik.Cms.Engine.ContentManager("Blogs")).GetContent(0, 0, "Publication_Date", new Guid[] { blog.Id });
    var x = blog.Posts;

    Makes posts.Count == 5 and blog.Posts.Count == 4

    Is there a way to force this property to update?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Aug 2010
    Link to this post
    Hi Bruno Michels,

    The "Posts" is actually IContent object. Try creating a new content item and call SaveContent of the ContentManager or BlogManager.Content.SaveContent(IContent). After that the value should show the new value.

    sample

    var blogManager = new BlogManager("Blogs");
    var cnt  = blogManager.Content.CreateContent("text/html");
    cnt.ParentID = new Guid("207e06ef-59b4-42e3-bce7-7e0e04347556");
    cnt.Content = "My first content ... some text";
    cnt.SetMetaData("Title", "Content Item Title");
    //save the content
    blogManager.Content.SaveContent(cnt);
    var blog = blogManager.GetBlog(cnt.ParentID);
    var c =blog.Posts;


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered