Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to initialize OData. with Breeze, Needed to support remote OData services

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>
like image 642
user1521126 Avatar asked Jun 13 '13 20:06

user1521126


1 Answers

For OData support with Breeze you will also need the datajs library from Microsoft. More information here as well: Breeze OData

like image 102
Jay Traband Avatar answered Nov 02 '22 13:11

Jay Traband