Are there any specific complex types that can't be returned by a WCF Service?
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?
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
精彩评论