You are right. RDDS cannot do such complex custom things.
We have publicly exposed our Where methods. Here is one of the overloads (in Telerik.Windows.Data.QueryableExtensions):
IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
(filterDescriptors.Count() > 0)
var parameterExpression = Expression.Parameter(source.ElementType,
var expressionBuilder =
expressionBuilder.Options.LiftMemberAccessToNull = source.Provider.IsLinqToObjectsProvider();
var filterLambda = expressionBuilder.CreateFilterExpression();
//TODO: Delegate the entire job to the FilterDescriptorCollectionExpressionBuilder just like the Sort is implemented.
So here is what this method does. You supply an IQueryable and a collection of FilterDescriptors. It takes this collection and based on it appends one or more Where method calls on the IQueryable and then returns it.
So the easiest way for you would be to provide some kind of dummy
(that is -- hollow, doing nothing) IQueryable to this method along with the FilterDescriptors and let it "do its thing" over this IQueryable. Then you can take this resulting IQueryable and read its Expression property. This is the LINQ Expression that our data engine has generated. The whole purpose of this dummy hollow IQueryable is for our data engine to create its Expression over it. Have in mind though that you might have to make the dummy IQueryable behave like its Provider is LinqToEntities and not LinqToObjects, since the generated expressions are somewhat different. When we detect LinqToObjects we add specials checks for null in all expression since SQL server does not care about nulls, but .NET does.
I checked your account and saw that you have our source code. If you want to delve into what we do to create this expression start with the method that I pasted above and drill down. Basically, the classes that interest you will be all classes inheriting from FilterExpressionBuilder
But I think that if you use our Where method and get the Expression that would be enough for you.
You can even use Expression Visitors and re-visit the expression that we have generated to suit your particular needs.
I hope this helps.
All the best,
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!