3
votes

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!

This question was posted by jpirok on our IdeaBlade forums. I am reposting the question and answer here since I think it will be useful to the Breeze Stack Overflow community.

1

1 Answers

3
votes

Absolutely, to switch to using an OData service simply initialize Breeze with the correct adapter. For OData this would look like:

breeze.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.