I would like to create a Facebook style “whats new” view for my asp.net mvc application.
This might generate content such as...
* Ciaran sent a message to The Rise and Fall of the Rockets
* Rick is going to Songs for the bathtub on Thursday, 28 June 2009
* Col became a fan of The Rise and Fall of the Rockets
* Leeroy posted Busk To Beat Cancer
* Tom went to HMV Showcase on Friday, 19 May 2009
He’s the approach that’s currently in my head….
Each of these items represents different types of content.
For example, gigs, news, comments etc
Each content type is stored in a different database table ie gigs, news, comments etc:
When new content is added to the application (for example a news story is created) I am planning on creating an additional entry into a “WhatsNew table”
Table1: WhatsNew
id, contentId, createdDate
Table2:
userId, contentId
When a user has viewed a piece of content an entry is added to Table 2 (the id of the user and the content).
The view above is created by:
1) Returning contentIds from the WhatsNew table which don’t have an entry in table 2 for the particular logged in user, ordered by created date.
Then I ask my newsManager, gigsManager etc to give me summary content based upon these ids. I can just pass all the ids even though they may represent different types of content since contentids are guids and I’m assuming I wont get any collisions across my tables ( I only have one db). Alternatively I could use a discrimator of some sort....
All summary objects implement ISummary and may also contain bespoke data. So I now have a List which I pass to a view…
Each summary type has a partial view which knows how to render it. The partial used to render a particular item will be selected based upon the summaries type.. (Note that the list WILL contain different types of summary….
Note that I don’t want the WhatsNew table to actually contain the headline strings such as “Rick is going to Songs for the bathtub on Thursday, 28 June 2009 “ since this will make it difficult to
1) change how I generate these – i.e. I might phrase them differently depending on the users location.
2) Internationalise dates etc.
Also this would also mean that say the newsManager/gigsManager which generated the headline would need knowledge about the websites routing ..
for example the headline “Rick is going to Songs for the bathtub on Thursday, 28 June 2009 “ contain multiple links!!
Thoughts? Does this seem sensible? It feels icky.