I have recently updated all of my nuget packages to the latest for EF6, breeze 1.4.5, system.web.http.odata 5.0.0.0, and all the other good bits available.
Now, with one query that contains an expansion like x.y.z I get an error as follows:
A first chance exception of type 'Microsoft.Data.OData.ODataException' occurred in System.Web.Http.OData.dll
Additional information: The request includes a $expand path which is too deep. The maximum depth allowed is 2. To increase the limit, set the 'MaxExpansionDepth' property on QueryableAttribute or ODataValidationSettings.
I looked into the suggested fixes. If I add a Queryable attribute on the breeze 'endpoint' being queried, it appears to cause all sorts of other problems. My guess is it interferes with breeze's expected behaviour and formats the results differently.
I then looked into the using the HttpConfiguration EnableQuerySupport extension method, through GlobalConfiguration.Configuration..., but that appears to have no effect (see Supporting OData Query Options)
Does anybody have any idea how I can change the default webapi behaviour?
Thanks.
you need to add a BreezeQueryable attribute to your breeze controller IQueryable method like this ...
[BreezeQueryable(MaxExpansionDepth = 3)]
public IQueryable<Customer> Customers()
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With