jimi,
A few quick questions / remarks. I have pretty much used my own formatting in the TBH-code. First of all I replaced everything tbh_ with my own namespaces etc. Secondly, I used line breaks etc to make the code a tad more readable.
Of course, all of that bit me in the ass when I tried comparing your code with my code (using ExamDiff. I know, I'm just one of those people who wants to know what changed ;)), so if anyone new reads this, it'll save you time sticking to Marco's formatting.
In your readme, for the posts.cs you state that the only change you made was an addition to the cache purging. There's numerous other changes as well, though.
Also, here's a little something to compliment your code. It's from adding the Priority column to the Posts table. I chose just to give it a default value of 0. The script can be used if there is data in the table (I think. I think mine is empty, but it ought to work anyway):
/* To prevent any potential data loss issues, you should review this script in detail before running it outside the context of the database designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_EO_Posts_AddedDate
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_EO_Posts_ParentPostID
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_Table2_Approved
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_EO_Posts_Closed
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_EO_Posts_ViewCount
GO
ALTER TABLE dbo.EO_Posts
DROP CONSTRAINT DF_EO_Posts_ReadCount
GO
CREATE TABLE dbo.Tmp_EO_Posts
(
PostID int NOT NULL IDENTITY (1, 1),
AddedDate datetime NOT NULL,
AddedBy nvarchar(256) NOT NULL,
AddedByIP nchar(15) NOT NULL,
ForumID int NOT NULL,
ParentPostID int NOT NULL,
Title nvarchar(256) NOT NULL,
Body ntext NOT NULL,
Approved bit NOT NULL,
Closed bit NOT NULL,
ViewCount int NOT NULL,
ReplyCount int NOT NULL,
Priority int NOT NULL,
LastPostBy nvarchar(256) NOT NULL,
LastPostDate datetime NOT NULL
) ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_AddedDate DEFAULT (getdate()) FOR AddedDate
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_ParentPostID DEFAULT ((0)) FOR ParentPostID
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_Table2_Approved DEFAULT ((1)) FOR Approved
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_Closed DEFAULT ((0)) FOR Closed
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_ViewCount DEFAULT ((0)) FOR ViewCount
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_ReadCount DEFAULT ((0)) FOR ReplyCount
GO
ALTER TABLE dbo.Tmp_EO_Posts ADD CONSTRAINT
DF_EO_Posts_Priority DEFAULT 0 FOR Priority
GO
SET IDENTITY_INSERT dbo.Tmp_EO_Posts ON
GO
IF EXISTS(SELECT * FROM dbo.EO_Posts)
EXEC('INSERT INTO dbo.Tmp_EO_Posts (PostID, AddedDate, AddedBy, AddedByIP, ForumID, ParentPostID, Title, Body, Approved, Closed, ViewCount, ReplyCount, LastPostBy, LastPostDate)
SELECT PostID, AddedDate, AddedBy, AddedByIP, ForumID, ParentPostID, Title, Body, Approved, Closed, ViewCount, ReplyCount, LastPostBy, LastPostDate FROM dbo.EO_Posts WITH (HOLDLOCK TABLOCKX)')
GO
SET IDENTITY_INSERT dbo.Tmp_EO_Posts OFF
GO
DROP TABLE dbo.EO_Posts
GO
EXECUTE sp_rename N'dbo.Tmp_EO_Posts', N'EO_Posts', 'OBJECT'
GO
ALTER TABLE dbo.EO_Posts ADD CONSTRAINT
PK_EO_Posts PRIMARY KEY CLUSTERED
(
PostID
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
COMMIT
Overall, you did some awesome work that saved me (and undoubtedly others as well) numerous hours of work. Thank you so much :)
I''ll see if at any time soon I'll get a chance to check out the code with the temporary tables to see if it can be optimised. One possible quick win would be to use table variables instead of temp tables, but it depends on exactly what happens in the code.
For now, I would love to check it out, but I'm hoping to have a site up before the end of the weekend, and I still want to try and have a go at implementing private messages, and the Webparts (if I understand correctly, they're like widgets. However, I haven't reached that section of the book yet) before then as well, so you'll have to forgive me :)
Maxxim - I'll also see some time after launch if I can somehow shift the user's postcount to a column of its own, and I'll keep you in the loop :)
Cheers,
Peter
http://entropia-online.blogspot.com/