问题
I have a .Net mobile service.
Calling this:
https://xxx.azure-mobile.net/tables/items?$filter=(company%20eq%20%27987af3f9-8d44-4a9d-8be2-7e0567287106%27)
Returns:
{"message":"The query specified in the URI is not valid. Could not find a property named 'company' on type 'Default.<>f__AnonymousType2_3OfString_String_Double'."}
The field name in the "items" entity model is "company" and on the database is "company_Id", neither will work.
Using http://ajax.aspnetcdn.com/ajax/mobileservices/MobileServices.Web-1.2.5.min.js
What could be wrong?
回答1:
It turns out that you are running into a casing bug in the .NET backend when $select or $filter is used. The workaround is to use Pascal case (i.e., uppercase first letter) for your property names.
回答2:
Problem was that you can only filter a field that is present in the $select clause. As said here Doesn't make sense but anyway...
回答3:
Having the first character as lower case for my column names prevented me from querying my Azure database with LINQ or Lambda expressions.
Switching them to upper case letters did the trick.
来源:https://stackoverflow.com/questions/27750227/where-clause-returning-the-query-specified-in-the-uri-is-not-valid