Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Lee Crowe
Oct 10, 2011
  2551
(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 CMS easy RSS feed integration library

As I've mentioned in my  previous blog post , while I was developing the Optimizely version of my blog, I tried to look for a library that could...

David Drouin-Prince | Jan 25, 2025 | Syndicated blog

Decimal numbers in Optimizely Graph

Storing prices as decimal numbers on a commerce website and planning to expose them through Optimizely Graph? It might not be as straightforward as...

Damian Smutek | Jan 23, 2025 | Syndicated blog

Find and delete non used media and blocks

On my new quest to play around with Blazor and MudBlazor I'm going back memory lane and porting some previously plugins. So this time up is my plug...

Per Nergård (MVP) | Jan 21, 2025

Optimizely Content Graph on mobile application

CG everywhere! I pull schema from our default index https://cg.optimizely.com/app/graphiql?auth=eBrGunULiC5TziTCtiOLEmov2LijBf30obh0KmhcBlyTktGZ in...

Cuong Nguyen Dinh | Jan 20, 2025