Calling string.ToUpper() is causing an issue

Apr 6, 2012 at 12:40 PM

I am trying to execute a query leveraging LinqToLdap library to bring back results for my application however as part of the implementation I needed execute a where condition with a call to string.ToUpper() and here is an example:

Users.Where(user => user.Firstname.ToUpper() == "test".ToUpper());

The call will fail due to the fact that the ToUpper() is going to be attempted to be converted into an LDAP statement which is not supported.
It would be nice to be able to ignore methods that are not translatable into LDAP instead of throwing exceptions.
The reason I need to have this ability is because I have an interface that abstracts away the LinqToLdap library so that I can swap it out with a dummy
implementation for doing local development and if I am using an In-Memory list then I have to perform the ToUpper() call so that I can ensure that the input and the values coming back from the source are of the same format.

Any recommendations are greatly appreciated.

Apr 9, 2012 at 2:34 AM

I'll add this to the work items for 3.0.  As of right now there's no real workaround other than rewriting the expression yourself.

Apr 23, 2012 at 1:08 AM

This has been fixed in changeset 12207.  Firtname.ToUpper() will be ignored, but "test".ToUpper() will still be converted to "TEST".