The new object models…
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Road.Models { public enum TopicStatus : byte { Open, Closed, Hidden, HiddenClosed, InTagPromoted, InTagPromotedClosed, Promoted, PromotedClosed }; public enum TagStatus : byte { Open, Closed, NoAnon, AnonModerated, Moderated }; public enum ReplyStatus : byte { Open, Hidden } public enum PrivilegeFlag : byte { CanEditPosts, CanPromoteTopics, CanPromoteTags, CanEditTags, CanModerate } public class Entity { public int Id { get; set; } public DateTime CreatedDate { get; set; } public DateTime LastModified { get; set; } } public class NamedEntity : Entity { public string Slug { get; set; } public string Name { get; set; } public string DisplayName { get; set; } } public class Creator : NamedEntity { public string Email { get; set; } public string IP { get; set; } public string Web { get; set; } public string Bio { get; set; } public string Avatar { get; set; } public string Session { get; set; } public int MemberId { get; set; } public Creator() { MemberId = 0; } } public class PageEntity : NamedEntity { public DateTime? LastActivity { get; set; } public Creator CreatedBy { get; set; } public string Summary { get; set; } public string Body { get; set; } public string ContentHash { get; set; } public bool Approved { get; set; } } public class Topic : PageEntity { public LazyList<Tag> Tags { get; set; } public PagedList<Reply> Replies { get; set; } public int ViewCount { get; set; } public int ReplyCount { get; set; } public float? Threshold { get; set; } public TopicStatus Status { get; set; } public Topic() { this.Id = 0; this.Status = TopicStatus.Open; this.ViewCount = 0; this.ReplyCount = 0; this.Threshold = 0; this.Approved = true; } } public class Reply : PageEntity { public int TopicId { get; set; } public float? Threshold { get; set; } public ReplyStatus Status { get; set; } public Reply() { this.Id = 0; this.Status = ReplyStatus.Open; this.Threshold = 0; this.Approved = true; } } public class Tag : PageEntity { public TagStatus Status; public PagedList<Topic> Topics; public Tag() { this.Status = TagStatus.Open; // Tags should be manually approved by a mod this.Approved = false; } } }
Can you forward your script to create that schema? Thanks!
Hey Sky,
Here you go…
(Please keep in mind that this schema may change quite a bit since it’s still a work in progress.)
USE [ContentManagement]
GO
/****** Object: Table [dbo].[Posts] Script Date: 03/08/2012 23:48:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Posts](
[PostId] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NOT NULL,
[Title] [nvarchar](100) NOT NULL,
[Slug] [nvarchar](100) NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[LastModified] [datetime] NOT NULL,
[LastActivity] [datetime] NOT NULL,
[BodyText] [nvarchar](max) NOT NULL,
[BodyHtml] [nvarchar](max) NOT NULL,
[ContentHash] [nvarchar](max) NOT NULL,
[ViewCount] [int] NOT NULL,
[ReplyCount] [int] NOT NULL,
[IsApproved] [bit] NOT NULL,
[Status] [int] NOT NULL,
[Threshold] [float] NOT NULL,
CONSTRAINT [PK_Posts] PRIMARY KEY CLUSTERED
(
[PostId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Posts] ADD CONSTRAINT [DF_Posts_ParentId] DEFAULT ((0)) FOR [ParentId]
GO
/****** Object: Table [dbo].[PostTags] ******/
CREATE TABLE [dbo].[PostTags](
[TagId] [int] IDENTITY(1,1) NOT NULL,
[TagName] [nvarchar](80) NOT NULL,
[DisplayName] [nvarchar](100) NOT NULL,
[Slug] [nvarchar](80) NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[LastModified] [datetime] NOT NULL,
[BodyText] [nvarchar](max) NULL,
[BodyHtml] [nvarchar](max) NULL,
[PostCount] [int] NOT NULL,
[IsApproved] [bit] NOT NULL,
[Status] [int] NOT NULL,
CONSTRAINT [PK_PostTags] PRIMARY KEY CLUSTERED
(
[TagId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[PostTagRelationships] ******/
CREATE TABLE [dbo].[PostTagRelationships](
[PostTagId] [int] IDENTITY(1,1) NOT NULL,
[TagId] [int] NOT NULL,
[PostId] [int] NOT NULL,
CONSTRAINT [PK_PostTagRelationships] PRIMARY KEY CLUSTERED
(
[PostTagId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[PostTagAuthorRelationships] ******/
CREATE TABLE [dbo].[PostTagAuthorRelationships](
[TagAuthorId] [int] IDENTITY(1,1) NOT NULL,
[TagId] [int] NOT NULL,
[AuthorId] [int] NOT NULL,
CONSTRAINT [PK_PostTagAuthorRelationships] PRIMARY KEY CLUSTERED
(
[TagAuthorId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Authors] ******/
CREATE TABLE [dbo].[Authors](
[AuthorId] [int] IDENTITY(1,1) NOT NULL,
[AuthorName] [nvarchar](80) NOT NULL,
[AuthorIP] [nvarchar](100) NOT NULL,
[AuthorEmail] [nvarchar](500) NULL,
[AuthorWeb] [nvarchar](255) NULL,
[SessionHash] [nvarchar](500) NOT NULL,
[MemberId] [int] NOT NULL,
CONSTRAINT [PK_Authors] PRIMARY KEY CLUSTERED
(
[AuthorId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[PostAuthorRelationships] ******/
CREATE TABLE [dbo].[PostAuthorRelationships](
[PostAuthorId] [int] IDENTITY(1,1) NOT NULL,
[PostId] [int] NOT NULL,
[AuthorId] [int] NOT NULL,
CONSTRAINT [PK_PostAuthorRelationships] PRIMARY KEY CLUSTERED
(
[PostAuthorId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[Members] ******/
CREATE TABLE [dbo].[Members](
[MemberId] [int] IDENTITY(1,1) NOT NULL,
[Username] [nvarchar](80) NOT NULL,
[DisplayName] [nvarchar](100) NULL,
[Password] [nvarchar](500) NOT NULL,
[PasswordSalt] [nvarchar](100) NOT NULL,
[Email] [nvarchar](500) NOT NULL,
[Slug] [nvarchar](80) NOT NULL,
[CreatedDate] [datetime] NOT NULL,
[LastModified] [datetime] NOT NULL,
[LastActivity] [datetime] NOT NULL,
[Avatar] [nvarchar](255) NULL,
[Web] [nvarchar](255) NULL,
[Bio] [nvarchar](max) NULL,
[IsApproved] [bit] NOT NULL,
[IsLockedOut] [bit] NOT NULL,
CONSTRAINT [PK_Members] PRIMARY KEY CLUSTERED
(
[MemberId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO