Queries require a model. Consider using the EnableQueryAttribute.GetModel method to never return a null value

I am using AspNetCore 2.0.0 and I am trying to integrate OData.

I found the nuget package https://www.nuget.org/packages/microsoft.aspnetcore.odata and also this question on SO "How to register OData with ASP.NET 5" β†’ How to register OData using ASP.NET 5

I added services.AddOData(); in ConfigureServices and decorated the api with EnableQuery .

As soon as I compiled the code and tried to access the api, I get this error: A model is required for querying. Consider implementing the EnableQueryAttribute.GetModel method never to return a null value. A model is required for querying. Consider implementing the EnableQueryAttribute.GetModel method never to return a null value.

I should also mention that IApplicationBuilder for some reason does not contain a UseOData defenition definition.

Can anyone use this?

+5
source share

Source: https://habr.com/ru/post/1272656/


All Articles