OData / WebApi

OData Web API: A server library built upon ODataLib and WebApi
https://docs.microsoft.com/odata
Other
855 stars 473 forks source link

OData v4 stopped expanding beyond 3rd depth #864

Open ndenkha opened 7 years ago

ndenkha commented 7 years ago

Hi guys,

I've had this issue opened for a while but haven't gotten any answer on. This used to work fine and suddenly stopped expanding after 3rd level.

http://stackoverflow.com/questions/40481594/odata-v4-stopped-expanding-beyond-3rd-depth

Hope someone can shed some light on it.

Ninos

ndenkha commented 7 years ago

Hi, is anyone out there that's taking a look at this?

TehWardy commented 7 years ago

See my answer to your question on StackOverflow, it works for me. I have found situations where expands don't work because of issues resolving LINQ query paths but in your case (at least in the example) that shouldn't be a problem.

ndenkha commented 7 years ago

Thanks War, see my respond on StackOverflow.

biaol-odata commented 7 years ago

Hi ndenkha, thanks for your support for OData. Can you please provide further details regarding: 1). Any error message, stack trace from exception etc that can help debugging? 2). You said it stop working suddenly. Is there any OData libraries upgrade involved?

SKvasnytsia commented 4 years ago

Hi, experiencing the same issue. I have added all required entity sets, but still, have the issue with 4th level :( Even commented all entity sets and the result was the same. Also added [EnableQuery(MaxExpansionDepth = 5)] to action. SQL Profiler shows correct entities and a proper amount of joins, but the response is not valid.

davidyee commented 4 years ago

We had the same issue in our project too (expanding to 4 and error message about max expansion to 3) despite adding the new expand depth on both the model configuration for the entity and the controller EnableQuery MaxExpansionDepth parameter.

What worked for us was also adding a depth of 4 on the model configuration for one of the related models that was being expanded. I'm not sure why that was required when the depth was correctly specified on the original entity set though.

diegodalben commented 4 years ago

Hi, I have this problem. I set the "MaxExpansionDepth" property to 5 in the "AddODataQueryFilter" extension in Startup.cs. When expanding to 4 levels, the query in the DB is performed correctly, with JOIN for the 4 tables, but only 3 levels are displayed on response. Has anyone managed to solve this problem in any way?