WCF Data Services/ RIA Services概念

WCF Data Services

WCF Data Services (or Data Services for short) is another data-centric communication technology built on the WCF stack that exposes data to clients as JSON- or ATOM-serialized RESTful resources using the OData protocol. The OData protocol specifies how a client can query, navigate, and update data exposed by a service. Using this protocol, the client can communicate with the service in a RESTful manner by retrieving data using a standard HTTP GET call (using specially constructed URIs), and sending updates to the server using a standard HTTP POST call.

WCF Data Services是服务以REST的形式发布是非常的简单,相比WCF服务

  1. 查询方面:由于引入了查询表达式,因此对于查询条件动态变化的情况非常的方便【由于是动态执行,当然相比存储过程来说性能会有一定的损失,如果性能问题突出的话,同样可以使用Service Operations或则WCF Service进行处理】
  2. 由于基于REST,因此服务和其他的集成更方便

Data Services vs. RIA Services

Data Services shares a number of similarities with RIA Services, and in a way you could consider the two to be sibling technologies, at times both jostling for attention and attempting to outdo each other. Both are built on top of WCF and conform to a pattern to expose data to clients, but each has a somewhat different focus. RIA Services (at least for the time being) specifically targets Silverlight clients, whereas Data Services is client agnostic. While RIA Services generates code in the client project in order for the client to communicate with the services (an aspect that concerns some developers who are against “magic” code generation that they have no control over), Data Services does not need a link to the client project, and no code generation is required. Instead, Data Services provides a client library (discussed shortly) to help the client interact with the service.

It can be difficult to identify whether you should use RIA Services or Data Services in your project, and how the two differ. However, you can break it down to the following:

•  RIA Services has a rich model designed for the development of end-to-end Silverlight applications (with the server tightly linked with its client via the code generation process). 

•  Data Services is designed simply to expose data as RESTful resources in a standalone manner that a range of clients can consume (such as reporting tools that can consume data exposed over HTTP and serialized as either ATOM or JSON).  That said, RIA Services can also expose data as RESTful resources that can be consumed by a range of clients (by enabling OData or exposing a JSON endpoint using the functionality provided in the WCF RIA Services Toolkit). Also, together with its ability to share code and validation logic with the client (among the numerous other features it provides), you will find it the best solution when writing an end-to-end Silverlight application. However, if you want your service to support a wide variety of clients without having a tight relationship to your Silverlight project, Data Services is a viable alternative.

你可能感兴趣的:(service)