November Happy Hour will be moved to Thursday December 5th.

Lee Crowe
Oct 10, 2011
  2532
(2 votes)

FindPagesWithCriteriaContext v1.1

Just over a couple of weeks ago I released the FindPagesWithCriteriaContext class.  This essentially provides a nice little Linq wrapper over the top of the FindPagesWithCriteria API, more details can be found here.

The reason for the blog post is that I have added a few new little features to it which some people may be interested in these are shown below.  Basically you can now search for properties that are not properties of the PageData or PageTypeBuilder page type implementation.  This is done by using the new “GetPropertyValue” extension method which accepts a property name and property data type as parameters.

1. Find pages of a specific page type “ImageGalleriesPageType” which contain the text “GalleryOne” within a serialized entity custom property named “ImageGalleryCollection”:

  1: var query = new FindAllPagesWithCriteriaContext<ImageGalleriesPageType>(PageReference.StartPage)
  2:                 .Where(p => p.ImageGalleryCollection.ToString().Contains("GalleryOne"));

2. Find pages of a specific page type “ImageGalleriesPageType” which have a property named “ImageGalleryCollection” with a value of “test”.

  1: query = new FindAllPagesWithCriteriaContext<ImageGalleriesPageType>(PageReference.StartPage)
  2:                 .Where(p => p.GetPropertyValue("ImageGalleryCollection", PropertyDataType.LongString).ToString() == "test");

3. Find pages of a specific page type “ImageGalleriesPageType” which have a property named “ImageGalleryCollection” which contains the text “GalleryOne”.

  1: query = new FindAllPagesWithCriteriaContext<ImageGalleriesPageType>(PageReference.StartPage)
  2:                 .Where(p => p.GetPropertyValue("ImageGalleryCollection", PropertyDataType.LongString).ToString().Contains("GalleryOne"));

4. Find pages of a specific page type “ImageGalleriesPagetype” which have a property named" “ImageGalleryCollection” which is null.

  1: query = new FindAllPagesWithCriteriaContext<ImageGalleriesPageType>(PageReference.StartPage)
  2:                 .Where(p => p.GetPropertyValue("ImageGalleryCollection", PropertyDataType.LongString) == null);

For more details of usage please refer to the previous blog post.

 

Feedback

Feedback as always is greatly received.  If there are bugs/issues please feel free to email or twitter me @croweman and I will do my best to resolve them.

Oct 10, 2011

Comments

Please login to comment.
Latest blogs
Optimizely SaaS CMS + Coveo Search Page

Short on time but need a listing feature with filters, pagination, and sorting? Create a fully functional Coveo-powered search page driven by data...

Damian Smutek | Nov 21, 2024 | Syndicated blog

Optimizely SaaS CMS DAM Picker (Interim)

Simplify your Optimizely SaaS CMS workflow with the Interim DAM Picker Chrome extension. Seamlessly integrate your DAM system, streamlining asset...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Optimizely CMS Roadmap

Explore Optimizely CMS's latest roadmap, packed with developer-focused updates. From SaaS speed to Visual Builder enhancements, developer tooling...

Andy Blyth | Nov 21, 2024 | Syndicated blog

Set Default Culture in Optimizely CMS 12

Take control over culture-specific operations like date and time formatting.

Tomas Hensrud Gulla | Nov 15, 2024 | Syndicated blog