Open hidegh opened 6 years ago
@hidegh - Can you provide an example URL? I suspect one issue is that you are using OData components outside of an OData route, i.e. there is no MapODataServiceRoute()
and the URL's root path is api or null.
@robward-ms yes, I do use the classic API endpoint (ohh, not in the sample), so:
[EnableQuery]
[Route("api/orders")]
public IQueryable
and so the call is like: localhost:10900/api/orders/?$top=5&$filter=contains(OrderNumber,'123')
Since OData is great for querying, and there are some components already using OData as source, the aim is to allow odata queries against our endpoints (which might be IQueryable over in-memory objects) with minimal config.
Actually nor camel-case name formatting, nor case insensitive property names are allowed and also haven't tried case-insensitive searches, but the concept above worked nicely before.
@hidegh - To just to clarify, the scenario you want to enable is using EnableQueryAttribute outside of the context of an OData route and it's formatters, routing convents, etc...
@robward-ms exactly. since it's the most obvious use-case for OData - querying. it also works with some limitations which the prev. versions did not had (see 1st entry here).
Actually what I don't get is, that there's the base OData library & now there's a lot of extra work with the extras on AspNetCore. But taking the simplicity approach (at least the query part), it's just a query in the URI, which could be treated as a string (of key/values, so not really WEB dependent) and the rest is just to apply parsed value on an IQueryable
@robward-ms hi, yes, I use default API routes, similar to this: https://github.com/OData/WebApi/issues/1748#issuecomment-565027024.
I was although not able to reproduce the issue with the latest .NET Core 3.1 and Odata 7.2.3 version (I use a fairly simple app, and just added the extra, non projected parameter to the Dto which then I even used in querying)...
NotSupportedException: The specified type member 'Reserved' is not supported in LINQ to Entities.
Assemblies affected
microsoft.aspnetcore.odata\7.0.0-beta1
Reproduce steps
Startup.cs (camel case and enable case insensitive does not work - BUG)
Controller:
Expected result
Since the extra fields are not used in the queries and are not present on the IQueryable, it should pass. The MVC5 OData was ignorant of extra params.
Actual result
The exception (see above).
Additional detail
no