Bug with Field Names that end in 's'

We implemented AutoQuery on a SQL table and it has been working nicely. Today our UI developer went to add a query that would pull all records that had a Status of 1 or 2 from the table. Usually with AutoQuery, adding an ‘s’ to the end of the field would allow syntax such as ?Statuss=1,2 but in this case when the extra s is added, the parameter is ignored completely and all records are returned, regardless of status. If the extra ‘s’ isn’t added then the query comes back empty since it does an ‘=’ match and none have status ‘1,2.’

Looking into the source code, you are using TrimEnd here to remove the trailing s before you do the match on the field name, but TrimEnd “Removes all trailing occurrences” of the s, which is causing the problem. Since you know its only the last character, no reason to use TrimEnd here.

As an aside, per this discussion, there is no SQL performance difference in using IN on a single record vs using =, so it may simplify things if you just always used IN, which supports both single and multiple. That said, I have no clue on what the ramifications of that may be to other storage systems or the rest of your code.


This should now be resolved from this commit which is available from v5 that’s now available from MyGet. Please review the v5 changes before upgrading.

thanks for the quick fix!