OData 和 REST Web 服务之间的区别 [英] Difference between OData and REST web services

查看:25
本文介绍了OData 和 REST Web 服务之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OData 和 REST-ful Web 服务有什么区别?

What is the difference between OData and REST-ful web services?

推荐答案

UPDATE 警告,由于 OData V4 可用,此答案已过时.

UPDATE Warning, this answer is extremely out of date now that OData V4 is available.

我不久前写了一篇关于这个主题的帖子这里.

I wrote a post on the subject a while ago here.

正如 Franci 所说,OData 基于 Atom Pub.然而,他们在顶部分层了一些功能,不幸的是忽略了过程中的一些 REST 约束.

As Franci said, OData is based on Atom Pub. However, they have layered some functionality on top and unfortunately have ignored some of the REST constraints in the process.

OData 服务的查询功能要求您根据响应中不可用或链接到的信息构建 URI.这就是 REST 人所说的带外信息,并在客户端和服务器之间引入了隐藏的耦合.

The querying capability of an OData service requires you to construct URIs based on information that is not available, or linked to in the response. It is what REST people call out-of-band information and introduces hidden coupling between the client and server.

引入的另一个耦合是通过使用 EDMX 元数据来定义条目内容中包含的属性.可以在名为 $metadata 的固定端点上发现此元数据.同样,客户端需要提前知道这一点,它无法被发现.

The other coupling that is introduced is through the use of EDMX metadata to define the properties contained in the entry content. This metadata can be discovered at a fixed endpoint called $metadata. Again, the client needs to know this in advance, it cannot be discovered.

不幸的是,Microsoft 认为不适合创建媒体类型来描述这些关键数据片段,因此任何 OData 客户端都必须对其正在与之通信的服务和它正在接收的数据做出一系列假设.

Unfortunately, Microsoft did not see fit to create media types to describe these key pieces of data, so any OData client has to make a bunch of assumptions about the service that it is talking to and the data it is receiving.

这篇关于OData 和 REST Web 服务之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆