I'm using EPiServer Find to fetch all child pages, and I'm trying to make re-usable method which at it's heart is a Linq statement calling Find. Part of the linq is a "filter" method, which I'd like to be able to pass in. Currently, my method compiles but I cant correctly formulate something to pass into it.
The parameter giving me problems:
Expression<Func<T, Filter>> filterExpression
so i have a method that accepts the above filterExpression, but I've found no way of creating a value for that using types not already supported by the Episerverr Filters, in this instance I'd like to filter by type, but cant find a way to create a new filter to support new types of data. I've tried to use 'DelegateFilterBuilder' but again, new types dont seam to work
The heart of my resuable method I'm trying to create looks like this:
allChildPages = SearchClient.Instance.Search<T>().FilterForVisitor() .Filter(x => ((PageData)x).Ancestors().Match(pageRef.PageLink.ToString())) // find child pages of 'pageRef' .Filter<T>(filterExpression) // other potential filter .OrderByDescending(orderExpression)
Part of my problem is EPiServer.Find.Api.Querying.Filter is an abstract class with nothing but static methods (according to resharper decompile),
What am i missing? Is there some easy c# syntactic sugar I can use to solve my problem?