Chapter 5. Operations
The classic object- or component-oriented programming models offered only a single way for clients to call a method: the client would issue a call, block while the call was in progress, and continue executing once the method returned. Any other calling model had to be handcrafted, often incurring productivity and quality penalties. While WCF supports this classic invocation model, it also provides built-in support for additional operation types: one-way calls for fire-and-forget operations, duplex callbacks for allowing the service to call back to the client, and streaming to allow the client or the service to handle large payloads. In general, the type of operation used is part of the service contract and is an intrinsic part of the service design. The operation type may even place some constraints on the allowed bindings. Consequently, clients and services should be designed from the ground up with the operation type in mind, and you will not be able to switch easily between the various operation types. This chapter is dedicated to the various ways of invoking WCF operations and the related design guidelines.[2] Two other ways of invoking operations—asynchronously and queued—are addressed in subsequent chapters.
[2] This chapter contains excerpts from my article "WCF Essentials: What You Need to Know About One-Way Calls, Callbacks, and Events" (MSDN Magazine, October 2006).
Get Programming WCF Services, 2nd Edition 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.