I was thinking the last couple of days about a CS Mod that would add a "Watch" property to weblog posts. The idea would be to "watch" the activity of selected posts and thus be able to filter them in the Control Panel by this new property. Tonight's CS Source Session convinced me that its one of those mods that's simply not a good idea. Too many changes in too much of the underlying framework to make it happen. Doable, but not worth it.
On the positive side, it was a good time digging into the process of how the All Posts grid is populated, which is what I did for the last couple of hours tonight. You see, stepping through CS source and carefully reading each line of code is a lot like reading a Henry Miller novel, like Tropic of Cancer for instance. You want to take it slow and enjoy it, not rush through to see what happens in the end.
The All Posts grid, like much of CS, is populated from the CS.Components.ThreadSet object using one of the derived ThreadQuery objects, in this case a BlogThreadQuery object, which is passed through to the DataProvider.

Here's the BlogThreadQuery object that we're using, based on the filters set for the grid display. Since BlogThreadQuery is derived from ThreadQuery, there are more
properties used in the process of generating a ThreadSet for the grid,
but below are the essentials.
query (BlogThreadQuery)
{CommunityServer.Blogs.Components.BlogThreadQuery}
base {CommunityServer.Components.ThreadQuery}:
{CommunityServer.Blogs.Components.BlogThreadQuery}
BlogMirrorDisplayType: AllBlogs
BlogPostType: Post
BlogThreadType: Recent
Key: "B:5-P:-1-PN:-PI0-PS:10-C:0-DF:1/1/0001 12:00:00 AM-IP:All-BPT:Post-BTT:
Recent-BSB:MostRecent-SO:Descending-PC:Empty-IC:False-GID:-1-F:-IC:False-PAR:
-1-MPID:-L:-OT:False-T:-DTAllBlogs-Min:-1-Max:-1-Status:Ignore"
PostConfig: Empty
PublishedFilter: All
SortBy: MostRecentNotice the "Key" value. It's used here for caching purposes, but there is a lot of this Key-Value construct used in Community Server. I might be wrong, but I always felt this was such an efficient method to moving data! I'm a Key fan. I don't know if as a consequence I am Valued for that opinion or not.
So we're at the WebLogDataProvider layer now, the BlogThreadQuery arrives and we'll soon receive our ThreadSet as promised. Check out the highlighted @sqlPopulate NText datatype. How interesting! The BlogThreadQueryBuilder class is instantiated and its BuildQuery() method returns a SQL Query statement with our query object. (Keep reading below the code pics for the results!)

We pass a rather beefy SQL query as a parameter to our Stored Procedure which executes early in the proc, generating a single column table. The rest of the data is populated afterward from this temporary table all lickety split-like.
-- Create a temp table to store the select results
CREATE TABLE #PageIndex
(
IndexID int IDENTITY (1, 1) NOT NULL,
PostID int
)
--CREATE INDEX page_index ON #PageIndex(IndexID)
INSERT INTO #PageIndex (PostID)
EXEC (@sqlPopulate)
SET @TotalRecords = @@rowcount

And those were just a few smidgets of the process. My threadset musings for this Quiet Night in Clichy.
[tags: Community Server]