New Posts New Posts RSS Feed: oData samples without Web API or EF
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

oData samples without Web API or EF

 Post Reply Post Reply
Author
jpirok View Drop Down
Newbie
Newbie
Avatar

Joined: 12-Nov-2012
Location: Virginia
Posts: 1
Post Options Post Options   Quote jpirok Quote  Post ReplyReply Direct Link To This Post Topic: oData samples without Web API or EF
    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!
Back to Top
jtraband View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 19-Sep-2012
Posts: 55
Post Options Post Options   Quote jtraband Quote  Post ReplyReply Direct Link To This Post 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 https://breezejs.uservoice.com/forums/173093-breeze-feature-suggestions. 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
});
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down