Reputation: 1373
For my personal website, I am currently developing a CMS module. One of the features of the CMS module is page revision history. The website data access layer is being developed in Entity Framework Code First.
The problem I have is: How will I assign an 'active' revision to a page?
I see currently two options:
The Page
class / table will have an CurrentRevision
property/field which will point to the active page revision.
The page revision class / table will have an IsOnline
property.
First
(or something like that).What is the best way to implement this?
Upvotes: 0
Views: 113
Reputation: 364319
I didn't try it but I would try use the first approach. The con is not so big as it looks like because two database modifications command are not such a big problem (page publication is not operation you would do 100x per second) and in most scenarios you will need it anyway if your CMS will provide page editor because you will first save draft multiple times (no current online version) and only after that you will publish the page (you will have current online version).
You will still need to use the second approach if you would like to provide access to the last revision because the last revision doesn't have to be the published one.
Upvotes: 1