On Skip() and Page on non typed search

Dec 6, 2015 at 3:50 PM
Hi

I have to return results in pages but the query needs to be non typed. if I do it typed, I can work with Skip() and Page() just fine and the results returned match my expectations. But, in order for Skip to work, I also need to add an order statement. And I'm having trouble figuring out how to write that Order statement in case of a non typed query.

Here's my query:
                IQueryable<IDirectoryAttributes> userQuery = context.Query(directoryOu).Where(filter);
                IQueryable<IDirectoryAttributes> ids2 = userQuery.Select("cn", "uid", "objectGUID", "sn", "givenName", "whenChanged", "userAccountControl", "sAMAccountName");
                ids2 = ids2.OrderBy(u => u.GetString("sn"));
                List<IDirectoryAttributes> results = ids2.InPagesOf(10).ToList();
This would be a non working attempt to order the results by sn .. I've also tried u=> u.DistinguishedName which doesn't appear to be working (gets me a "{"DistinguishedName was not found as a mapped property on LinqToLdap.Collections.DirectoryAttributes"}") either and working with u.Entry also doesn't appear to get me anywhere.

What's the proper order statement so the above would start working?

Thanks
Stephan