使用Breeze与OData

3

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!

这个问题是jpirok在我们的IdeaBlade论坛上发布的。由于我认为它对Breeze Stack Overflow社区有用,所以我在这里转载问题和答案。
1个回答

3
当然,要切换到使用OData服务,只需使用正确的适配器初始化Breeze即可。对于OData,代码如下:
breeze.config.initializeAdapterInstance("dataService", "OData");

请确保在创建第一个实体管理器之前进行此调用,并记住使用OData uri作为服务名称。
这提供了完整的OData查询支持。尽管OData保存尚未实现,但它们已经在近期的路线图中。如果您真的需要OData保存功能,您可能想在我们的Breeze用户声音https://breezejs.uservoice.com/forums/173093-breeze-feature-suggestions上投票。我们认真考虑这个场所来决定下一步该做什么。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接