locked
WCF Data Service Or WCF Service RRS feed

  • Question

  • 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.
    Tuesday, August 3, 2010 6:34 AM

Answers

  • Hi,

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

    Thanks,


    Vitek Karas [MSFT]
    • Marked as answer by Zafar.Yousafi Tuesday, August 3, 2010 9:19 AM
    Tuesday, August 3, 2010 8:26 AM
    Moderator

All replies

  • Hi,

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

    Thanks,


    Vitek Karas [MSFT]
    • Marked as answer by Zafar.Yousafi Tuesday, August 3, 2010 9:19 AM
    Tuesday, August 3, 2010 8:26 AM
    Moderator
  • 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
    Tuesday, August 3, 2010 9:27 AM
  • 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,


    Vitek Karas [MSFT]
    Tuesday, August 3, 2010 12:01 PM
    Moderator