BlogPost.Comments.Count is always 0
I'm trying to build a custom widget which shows the "most discussed" blog posts. This will work by counting the number of comments and displaying them ordered.
Whenever use the fluent api to get blog posts, the .Comments.Count property is always 0. I don't understand what I'm doing wrong.
My site has 2 blogs, with 7 posts, 2 of which have comments.
i think you don't do anything wrong. Here is what the Sitefinity Support told me a few days ago: "...it seems that Comments.Count property is not working as expected...".
You have to use some kind of workaround. Maybe retrieve all comments for that blog and then go on with your specific tasks:
Please let us know if your issue was resolved. Thanks so much.
the Telerik team
Thanks Matthias, that worked for me. For anyone else to come across this, my working code is:
Yes, you can use the Comments property from the BlogPostItem. I have included a code sample that retrieves all the live blog posts and then counts all the comments.
Is this bug going to be fixed? We are running into the same problem and do not want to have to make redundant calls to the database just to get the comments count if we already have the blog post object: dataItem.Comments.Count always shows zero.
This does not appear to work properly in sf6.3.5000. I attempt to use blogPost.Comments.Count and it's always 0.