Print Page | Close Window

oData samples without Web API or EF

Printed From: IdeaBlade
Category: Breeze
Forum Name: Community Forum
Forum Discription: Build rich JavaScript apps using techniques you already know
Printed Date: 22-May-2022 at 8:05pm

Topic: oData samples without Web API or EF
Posted By: jpirok
Subject: oData samples without Web API or EF
Date Posted: 13-Nov-2012 at 6:23am
I haven't seen any examples of using this framework that don't use Web API. 

How would I use breeze against an odata service using only the server's metadata to define the model? 
Will the context still be able to handle crud operations to a non web api service?

I have seen

    // service name is route to the Web API controller
    var serviceName = 'api/CarBones';

    /*** dataservice proper ***/
    // manager (aka context) is the service gateway and cache holder
    var manager = new entityModel.EntityManager(serviceName);

Can I do something like replacing the serviceName with an oData uri and then continue using breeze as usual?

    var serviceName = "http://localhost:1234/Northwind.svc"

Thanks for your help!

Posted By: jtraband
Date Posted: 13-Nov-2012 at 9:37am
Absolutely, to switch to using an OData service simply initialize breeze with the correct adapter. For OData this would look like

breeze.core.config.initializeAdapterInstance("dataService", "OData");

Make sure you make this call before creating your first EntityManager and remember to use an OData uri as the service name.

This provides full OData query support.  OData saves have not yet been implemented although they are on the near term roadmap.  If you really need OData save functionality, you might want to vote for it on our Breeze User Voice - . We take that venue seriously in making decisions about what to do next.

Note: we changed the "plugin/adapter" model with v 0.70 of Breeze.  Older versions use a now obsolete method

breeze.core.config.setProperties( {
    remoteAccessImplementation: breeze.entityModel.remoteAccess_odata

Print Page | Close Window