All pages available using Linq and DDS
I have been playing with some code that saves every published page into a Dynamic Data Store table. This is because I want to use Linq against that table and retrieve EPiServer pages.
I know there is a Querying EPiServer PageData using LINQ but I wanted to try out the DDS and check what kind of performance it gave.
I assume that all properties with the same name is the same property. If you are using a strong typed page type this shouldn't be a problem.
What I do first is to loop over all page types and make a store definition based on all properties those page types have. This I do on first access against the Store. and is done by providing a Dictionary<string, Type> with name and type.
Then it was time for using the datastore. One cool thing about the DDS is that even you have created a store with string,type dictionary you can access it with a class. The only thing you need is that the propertynames are the same.
So i made myself a class that contains those properties
and then I made a class that inherits from my typed store method class with the EPiServer built in properties with Page prefix names
There is no ACL checks here, but the helper method that converts a query to a PageDataCollection can do that
and even only return those pages we are interested in. Which is a huge problem with FindPagesWithCriteria, In the foreach here there will be executed a database call to retrieve the row from the database. I’m not particular happy with this implementation of the DDS. I would like to have a method to retrieve a given number of rows in one go. Paul Smith and I have agreed to disagree on this issue thou.
I first tried to have one store for each language and using the PageGuid as the guid in the store. That actually worked, but got a bit messy since you needed to know what store you wanted to access.
When I save to pages into the store I find the parents path and add a , before and after the PageCategory. this is to more easy do query’s against categories.
This means that we can do all kind of Linq searches
Have uploaded some files in the code section, and as you may see this is work in progress code :)
Will update the big table with new values when a page is published or moved/deleted
Is a admin plugin to start indexing all pages and add them to the big table. this will also show all properties that are available, and show those properties and pagetype where there are indifference.
Is the class where you can access the store
is a class with all the Page properties
Have not gotten around to test performance yet, but the ability to query against all fields and only retrieve the 5 latest should outperform the FindPagesWithCriteria. at least when we are looking at a big record set.
I think that EPiServer CMS6 should have something like this build in, and I think there is to long for some of us to wait for CMS7 that are promised Linq support on the pages.