Created
July 17, 2014 12:24
-
-
Save hagbarddenstore/61aa41e8416b5d216bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page | |
{ | |
public Guid Id { get; set; } | |
public DateTime CreatedOn { get; set; } | |
public Dictionary<string, string> Title { get; set; } | |
public Dictionary<string, string> Content { get; set; } | |
} | |
class Post | |
{ | |
public Guid Id { get; set; } | |
public DateTime CreatedOn { get; set; } | |
public Dictionary<string, string> Title { get; set; } | |
public Dictionary<string, string> Content { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Select a single page | |
SELECT * | |
FROM [Pages] AS p | |
LEFT JOIN [Resources] AS r ON r.[EntityId] = p.[Id] | |
WHERE p.[Id] = @PageId; | |
-- Select a single post | |
SELECT * | |
FROM [Posts] AS p | |
LEFT JOIN [Resources] AS r ON r.[EntityId] = p.[Id] | |
WHERE p.[Id] = @PostId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE [Pages] ( | |
[Id] UNIQUEIDENTIFIER NOT NULL, | |
[CreatedOn] DATETIME NOT NULL, | |
PRIMARY KEY ([Id]) | |
); | |
CREATE TABLE [Posts] ( | |
[Id] UNIQUEIDENTIFIER NOT NULL, | |
[CreatedOn] DATETIME NOT NULL, | |
PRIMARY KEY ([Id]) | |
); | |
CREATE TABLE [Resources] ( | |
[EntityId] UNIQUEIDENTIFIER NOT NULL, | |
[PropertyName] VARCHAR(100) NOT NULL, | |
[LanguageIsoCode] CHAR(7) NOT NULL, | |
[Value] NVARCHAR(MAX), | |
PRIMARY KEY ([EntityId], [PropertyName], [LanguageIsoCode]) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment