O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

[ServiceContract]
[ServiceKnownType(typeof(Circle))]
public interface IService1
{
[OperationContract]
ShapeBase GetShape(string name);
}

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required