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 ...
Get Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.