Specifying ServiceKnownType information in a programmatic way

WCF provides the ServiceKnownType feature for developers to declare all the custom types (which are not directly used as service operation parameters or return types) that will be sent as part of a WCF request/response object graph. However, the default declaration requires a developer to specify the ServiceKnownType statically in the source code. For example, the IService1 ServiceContract in the following code snippet shows a sample ServiceContract that specifies a custom type Circle as an additional known type:

public interface IService1
ShapeBase GetShape(string name);

In some cases, we will need to specify ...

Get Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.