There is no great answer here.
There are two settings you can use inside InitializeService (..)
config.SetEntitySetAccessRule("Feed", EntitySetRights.ReadSingle); config.SetEntitySetPageSize("Feed", 1);
Unfortunately, you are not doing what you want:
EntitySetRights.ReadSingle restricts you to returning only one object from this set. What fails because it does not allow / Categories (1) / Products AND also allows / Categories? $ Filter = ... return a string.SetEntitySetPageSize limits the amount of initial load that gets to the server to one record, but you can follow $ skiptoken to go and get the rest of the data one record at a time and in the same way as (1) it allows arbitrary requests and not only key predicates.
This leaves you with only one realistic option. Visit the LINQ expression and develop if you allow what is being done.
Since you use the Reflection provider, you basically need to wrap the IQueryables returned from your "context" class and look for invalid queries before passing them.
Not to lose consciousness.
If you decide to go this route, you will find a useful example of using IQueryable , and you should check the Viteks blog post series for data service expressions .
Hope this helps
Alex (OData Program Manager)
Alex james
source share