This sample shows one way to build an object-oriented programming interface for Service Broker applications. The sample contains classes that encapsulate the details of sending and receiving messages using the Service Broker DML. This sample forms the foundations for other sample applications included with the SQL Server 2005 samples.

The sample includes two different approaches to message dispatch. An application that uses this sample can use an attribute-based approach for message dispatch, or the application can implement a message processing loop.

Building the Sample

  1. CD to the ServiceBrokerInterface directory and execute the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:

    sn -k samplekey.snk

  2. Open the solution file Service Broker Interface.sln in Visual Studio 2005. This file is located in the cs directory within the ServiceBrokerInterface directory.

  3. Build the solution by pressing F6, or by selecting Build Solution from the Build menu.

Using the Sample

  1. Build the sample as described above.

  2. Add a reference to the assembly Microsoft.Samples.SqlServer.dll.

  3. In your code, add a using directive (C#) or Imports statement (Visual Basic) for the namespace Microsoft.Samples.SqlServer.

Requirements

This sample requires Visual Studio 2005. Because the sample uses features of the common language runtime that were not available in earlier versions, released versions of Visual Studio cannot build the sample.

Demonstrates

This sample demonstrates one way to represent Service Broker DML within a .NET language.