Developing Applications by Using the WCF Service Model
Windows Communication Foundation (WCF) provides a programming model called the WCF service model, as an alternative to the WCF channel programming model.
The WCF service model uses familiar .NET paradigms to hide the complexities of exchanging SOAP messages over a channel. The service model accomplishes this simplification by reading the entire SOAP message into memory before copying the information into .NET data structures. Loading long messages into memory, however, may not be practical for some applications. In these cases, developers should use the WCF channel model. For more information about using the WCF channel model, see Developing Applications by Using the WCF Channel Model.
At the lowest level, WCF presents the WCF channel model, in which clients invoke operations on a service by exchanging SOAP messages over a channel established between client and service endpoints. The WCF channel model exposes data types and methods that enable you to operate directly on the WCF channel architecture. The WCF channel model provides you with direct control over the contents of the SOAP messages you create and over the way both your application and the Microsoft BizTalk Adapter for SQL Server consume them. However, creating well-formed SOAP messages to send over a channel and validating the reply messages returned can be a detailed and exacting task.
The WCF service model uses proxy classes to invoke operations on a target service or to receive operations from a client. The SQL adapter exposes the SQL Server database as a WCF service on which you can invoke operations.
- The proxy class that is used to invoke operations on a target service is called a WCF client class. This class models the operations exposed by a service as .NET methods with strongly-typed parameters. By using the WCF service model, you can invoke the operations exposed by the SQL adapter as .NET methods on the WCF client. For more information about WCF clients, see "WCF Client Overview" at http://go.microsoft.com/fwlink/?LinkId=91458.
You can use either of the following tools to generate a WCF client class and associated helper code from the service metadata that the SQL adapter exposes:
- The ServiceModel Metadata Utility Tool (svcutil.exe), which ships with WCF.
- The Add Adapter Service Reference Visual Studio Plug-in, which ships with SQL adapter and is integrated with the Visual Studio design experience. This tool presents a standard Microsoft Windows interface that provides powerful browsing and searching capabilities on operations that the adapter exposes. For more information about how to generate a WCF client application, see Generating a WCF Client or WCF Service Contract for SQL Server Artifacts.
The topics in this section contain information, procedures, and examples to help you create and use the WCF service model to develop applications by using the SQL adapter.
- Overview of Using the WCF Service Model with the Adapter
- Metadata and the WCF Service Model
- Generating a WCF Client or WCF Service Contract for SQL Server Artifacts
- Specifying a Client Binding for the SQL Adapter
- Performing Insert, Update, Delete, and Select Operations by Using the WCF Service Model
- Performing Operations on Tables and Views with Large Data Types by Using the WCF Service Model
- Invoking Stored Procedures Using the WCF Service Model
- Invoking Scalar Functions in SQL Server by Using the WCF Service Model
- Invoking Table-Valued Functions in SQL Server by Using the WCF Service Model
- Performing ExecuteReader, ExecuteScalar, or ExecuteNonQuery Operations by Using WCF Service Model
- Polling SQL Server by Using the SQL Adapter with WCF Service Model
- Receiving Query Notifications Using the WCF Service Model