Whats the best way to handle large amounts of dynamic data

Topics: General
Jun 29, 2011 at 8:44 PM

I am new to the cms and have a question.  Lets say the client has a news section and under the news section categories which are then broken out by year, month then day.  What would be the best way to access and query the data in the codebehind.

The client is more of a article based type company.  When we exported their article data we ended up with close to 10,000 articles.

The structure would look something like this.

News                                  main news folder
   Business                           news category
      2011                             year
         01                              month
            01                           day

So when the news folder data structure is created it will have 8 main categories and years for 2009 2010 2011 then all 12 months and then days for each month. and then the articles would  be placed in each categories correct categorie, year, month and then day.

They want to have a pod on the home page that displays the 8 most recent articles by date sorted by date from any category.

Then there will be a news landing page that will have 8 pods for each of the 8 news categories, on this page they want to show the top 4
articles by date ascending.

I am just trying to figure out if there is a way with in the master page codebehind files if the data can be queried then formatted in a table structure and put into a literal to display on the page.  I was afraid that using xslt might be to slow with the amount of data they will have and the way it will be broken up.

Thank you......

Jun 29, 2011 at 9:45 PM
Edited Jun 30, 2011 at 12:08 PM

What kind of metadata do you have on your pages? Lets say you have a metatype with a DateTime field you would do this on your frontpage just to get newest across all categories

var news = DataFacade.GetData<IYourMetaType>().OrderByDescending(n => n.Date).Take(8).Select(n => new { Page = PageManager.GetPageById(n.PageId), Date = n.Date) });

Now, the categories are a bit more tricky, but you can use the PageStructureInfo class to get all the descendants of your current page, and use them as candidates for news and then apply same ordering and take logic as above.

var descendants = PageStructureInfo.GetSitemapByScope(SitemapScope.Descendants, PageRenderer.CurrentPageId).Select(x => new Guid(x.Attribute("Id").Value));
var news = descendants
   .Select(p => DataFacade.GetData<IYourMetaType>().SingleOrDefault(n => n.PageId == p.Id)
   .Where(n => n != null)
   .OrderBy(n => n.Date)
   .Select(n => new { Page = PageManager.GetPageById(n.PageId), Date = n.Date) });