Breeze - Error when using the ANY operator with OData

430 Views Asked by At

I have an error when i'm trying to use the ANY operator with Breezejs on OData service :

var query = breeze.EntityQuery.from("Orders")
              .where("orderLines", breeze.FilterQueryOp.Any, "quantity",  breeze.FilterQueryOp.GreaterThan, 50);

I'm getting the following error :

"TypeError: Cannot read property 'isAnonymous' of undefined
at proto._validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10334:27)
at Function.ctor.create (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10288:18)
at proto.validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10908:36)
at proto.validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10913:25)
at proto.toODataFragment (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10837:14)
at toFilterString (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10011:27)
at proto._toUri (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:9991:35)
at proto.toQueryString (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:6380:26)
at proto.getUrl (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:14140:61)
at fn.executeQuery (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:15073:34)".

This HTTP request works well :

http://localhost/api/service.svc/Orders?$filter=orderLines/any(ol:ol/quantity gt 50)

When I'm try to use metadata before execute the query I have the following error :

var query = breeze.EntityQuery.from("Orders").top(10);
manager.fetchMetadata().then(function () {
    return manager.executeQuery(query).fail(function (data) { 
        $log.error(data) 
    });
}).then(function (data) {
    $log.info(data);
});

Error: Unable to locate a 'Type' by the name: 'Order:#System.Data.Objects'. Be sure to execute a query or call fetchMetadata first.

Breeze seems to use the wrong namespace 'Order:#System.Data.Objects'. The right namespace is 'App.API.Context' like the exportMetadata function shows :

{
    "shortName": "Order",
    "namespace": "App.API.Context",
    "autoGeneratedKeyType": "Identity",
    ...
}

Thanks for your help !

0

There are 0 best solutions below