tags:

views:

8

answers:

1

Hi I have a question on the types that can be returned by a WCF service.Are there any specific complex types that can't be returned by a WCF service? To put more clearly, can we have any kind of complicated datatypes to be defined as Data Contracts and have them returned by the Service operations? Is there any limitation to any type?

Thanks & Regards

Padma

A: 

Yes - anything that cannot be serialized into a message constrained by a XML schema file.

This includes:

  • interfaces (only concrete types)
  • generics
  • any data structure that doesn't just contain data, but also behavior (like a SqlConnection or something like that)
  • the Windows API primitives, like a Brush or other drawing elements

The main point is: whatever you're trying to send from client to server must be able to be serialized into an XML message, expressed in a XML schema, and deserialized back into a new object

marc_s