.net WebApi OData + breeze => [Q] Raw reasons for rejection (must be empty)

I have a .net 4.5 Web Api with OData EntitySetController

On the client side, I got downloaded js files

jquery.min.js q.min.js datajs-1.1.1.min.js breeze.debug.js toastr.min.js angular.js 

when i call the following javascript

 breeze.config.initializeAdapterInstance("dataService", "OData"); var manager = new breeze.EntityManager(serviceName); var query = breeze.EntityQuery.from("Customers"); return manager.executeQuery(query).then(success).fail(fail); function success(data) { $log.info("Retrieved " + data.results.length); return data.results; } function fail(data) { $log.info("error " + data); } 

I see the following metadata on my chrome network tab, and json data is returned ...

 Request URL:http://localhost:49971/odata/$metadata Status Code:200 OK, 1.8KB Request URL:http://localhost:49971/odata/Customers Status Code:200 OK, 3.3KB 

BUT, but the success callback never works, the failure callback is executed. Can anyone help? All I see is

 XHR finished loading: "http://localhost:49971/odata/$metadata". datajs-1.1.1.min.js:14 XHR finished loading: "http://localhost:49971/odata/Customers". datajs-1.1.1.min.js:14 [Q] Unhandled rejection reasons (should be empty): [Error] length: 0 __proto__: Array[0] q.js:1010 error Error: OK 

Then I need to bind them to the ng-grid, ng-form and then finally send them back to the database on the server ...

A few more snapshots of the code and screen

 breeze.EntityQuery .from("AddressTypes") .using(new breeze.EntityManager(serviceName)) .execute() .then(function(data) { console.log(data); // never gets here very wierd }).fail(function(e) { console.log(e); // shows an error object with the AddressType Array }); 

I see an AddresTypes array in a callback failure ...

update: I temporarily switched to a BreezeContoller instead of an EntitySetController in the backend and commented on breeze.config.initializeAdapterInstance("dataService", "OData"); And I got my array in successCb. Therefore, I think I can assume that I have problems with DataJS. Really would like to stick with EntitySetController though ...

+6
source share
1 answer

I had the same problem. As it turned out, returning to datajs 1.0.3 seems to have worked. However, the implementation of this led to the fact that $ expand did not work (the server is working, but the wind does not process its navigation properties → regardless of its multiplicity).

I must say, I was terribly looking for the equivalent of billyzeys STABLE .

+1
source

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


All Articles