I am trying to create a simple JavaScript application using Breeze.js version 1.5.3. It is to consume an OData v4 service. The service is created with ASP.NET WebApi 2.
Included scripts:
<script src="/js/jquery.min.js"></script>
<script src="/js/underscore.js"></script>
<script src="/js/q.js"></script>
<script src="/js/datajs-1.1.3.js"></script>
<script src="/js/breeze.debug.js"></script>
Here is the code configuring Breeze's EntityManager:
var serverAddress = "http://localhost:6405/odata/";
breeze.config.initializeAdapterInstances({ dataService: "webApiOData4" });
var manager = new breeze.EntityManager(serverAddress);
The code fails with the following error: Uncaught TypeError: Cannot read property 'oData' of undefined
Here is the snippet from breeze.debug.js
that fails (around line 16591):
webApiOData4Ctor.prototype.initialize = function () {
// Aargh... they moved the cheese.
var datajs = core.requireLib("datajs", "Needed to support remote OData v4 services");
OData = datajs.V4.oData; // V4 is undefined, so it throws
OData.json.jsonHandler.recognizeDates = true;
};
I have searched through datajs-1.1.3.js
and found no 'V4' symbol. Moreover the authors of this library say that it only supports OData v3. Some suggest to use odatajs-4.0.0-beta-01.min.js
found here http://olingo.apache.org/doc/javascript/, but there is a clear dependency on datajs
in breeze.debug.js
source code. I have tried to include odatajs-4.0.0-beta-01.min.js
script in my page but it has not helped.
Does anybody know how to make Breeze.js work with OData v4 service?