I am trying to use breeze to call a wcf service, bij config breeze to use OData. But still I got the error:
Unable to initialize OData, Needed to support remote OData services
I also tried: breeze.config.initializeAdapterInstance("dataService", "OData");
Below I have the html page which i want to use.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="../Scripts/jquery-2.0.2.js"></script>
<script src="../Scripts/knockout-2.2.1.debug.js"></script>
<script src="../Scripts/q.js"></script>
<script src="../Scripts/breeze.debug.js"></script>
<script>
breeze.core.config.setProperties({
// the OData provider
remoteAccessImplementation: breeze.entityModel.remoteAccess_odata,
// this is the Knockout provider but we also provide a Backbone provider
// and we have others on the way
trackingImplementation: breeze.entityModel.entityTracking_ko
});
var myServiceName = "http://597de06c06404b47b1f1f592c56f6753.cloudapp.net/GoedendoelDataService.svc/? $format=json";
var em = new breeze.entityModel.EntityManager( {serviceName: myServiceName });
var query = breeze.entityModel.EntityQuery.from("Goedendoel")
.where("title", "startsWith", "G")
.orderBy("title");
em.executeQuery(query).then(function(data) {
// process the results here.
ko.applyBindings(data);
}).fail(function (e) {
alert(e);
});
</script>
</head>
<body>
<p data-bind="visible: !results">Fetching data ... </p>
<ul data-bind="foreach: results, visible: results" style="display: none">
<li>
<span data-bind="text:title"></span>
</li>
</ul>
</body>
</html>
For OData support with Breeze you will also need the datajs library from Microsoft. More information here as well: Breeze OData
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