文章出處

問:

Hi, I am newbie to wcf programming and a little bit confused between WCF Service and WCF Data  Service. Can someone please explain me these two service types. Can we use them alternatively or each one has its one well-defined specific area to use. Thanx in advance.

答:

WCF Services are operation centric - the main thing you do with these is define operations (functions). Data comes as a secondary thing in a way. On the other hand they can work over lot of different transports/protocols. You have the ability to strictly define what the client can and can not do. Client can't really make up new queries/operations, the server must implement everything the client needs.

WCF服務是以操作為中心的,你主要做的事情就是定義不同的操作(函數),數據放在一個次要的位置。另一方面,他們可以在許多不同的協議下工作。你可以嚴格的定義,客戶端能做什么,不能做什么。客戶端不能自己定義新的查詢/操作,服務端必做實現客戶端所要求的一切。

WCF Data Services are data centric - the main thing you do with these is define a data model to be exposed. Operations on the data are "predefined" (Create/Delete/Update/Read). It only supports HTTP protocol and uses REST. You usually allow clients to decide what they want to do (in some boundaries). One of the main differences from WCF Service is that the client can issue a query against the data model (think SQL like stuff) which the client constructs. This means that the server doesn't need to know exactly what the client needs up front, the client will be able to tell it runtime.

WCF數據服務是以數據為中心。你主要做的事情就是定義一個數據模型,并暴露出去。對數據的操作是“預定義”(創建/刪除/更新/讀取)。它僅支持HTTP協議和使用REST。允許客戶端來決定他們想要做什么(在某些界限下)。一個與WCF服務的主要區別是,客戶端可以對數據模型發起一個類型SQL的查詢。這意味著服務端并不需要預先知道客戶的需要,客戶端將能夠在運行時告訴它。

問:

Thanx for your response. It clears confusion i had in my mind. I appreciate if u please answer my following questions to further clarify the concepts.

  1. Can I use both wcf service and data service in a single service. I mean using single service reference.
  2. Can I add business logic in CRUD operations.
  3. Can I create service operations in wcf data service similar to what I can create in WCF service. (What I know is in wcf data service i can create service operations but they are very limited and allows only primitive data types as parameters.

Thanks

答:

Hi,

1. No - WCF Services and WCF Data Services need to be exposed as two different endpoints currently and as a result you need to service references on the client. The other reason is that the client classes generated for them are quite different and currently would not work together.

2. You can add bussiness logic to CRUD operations in general. The limitations depend on the actual provider and implementation of the WCF Data Service. Without knowing your requirements on what the bussiness logic should do and what provider you're going to use it's very hard to tell yes or no.

3. Service operations in WCF Data Services are indeed limited. You can't get the full power of WCF Services here.

Thanks,

 

原文地址:http://social.msdn.microsoft.com/Forums/en-US/687426d9-709f-4e73-8c4c-dd3630f006e7/wcf-data-service-or-wcf-service?forum=adodotnetdataservices


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()