Skip to Content
Programming WCF Services, 3rd Edition
book

Programming WCF Services, 3rd Edition

by Juval Lowy
August 2010
Intermediate to advanced
908 pages
26h 22m
English
O'Reilly Media, Inc.
Content preview from Programming WCF Services, 3rd Edition

Chapter 3. Data Contracts

WCF provides the ability to host and expose native CLR types (interfaces and classes) as services, as well as the ability to consume services as native CLR interfaces and classes. WCF service operations accept and return CLR types such as integers and strings, and the WCF clients pass in and process returned CLR types. However, such CLR types are specific to .NET. This poses a problem because one of the core tenets of service orientation is that services do not betray their implementation technologies across the service boundary. As a result, any client, regardless of its own technology, can interact with any service. This, of course, means that WCF cannot allow you to expose the CLR data types across the service boundary. What you need is a way of converting CLR types to and from a standard neutral representation. That representation is a simple XML-based schema, also known as an infoset. In addition, the service needs a formal way of declaring how the conversion is to take place. This formal specification is called a data contract, and it is the subject of this chapter. The first part of the chapter shows how data contracts enable type marshaling and conversions, and how the infrastructure deals with class hierarchies and data contract versioning. The second part shows how to use various .NET types, such as enumerations, delegates, data tables, and collections, as data contracts.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming WCF Services, 4th Edition

Programming WCF Services, 4th Edition

Juval Lowy, Michael Montgomery
Programming .NET Security

Programming .NET Security

Adam Freeman, Allen Jones

Publisher Resources

ISBN: 9781449382476Supplemental ContentErrata Page