How to: Update a Disconnected Service Agent

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
To create client business applications using current Microsoft technologies, see patterns & practices' Prism.

The Create Disconnected Service Agent recipe automates the creation of a disconnected service agent. Developers must modify the code in the generated service agent to implement application-specific logic.

If the remote service interface changes (for example, if an operation in the Web service is renamed or the number of parameters for the operation changes), you must update the service proxy and the service agent. The Update Disconnected Service Agent recipe regenerates the service agent without impacting your custom application logic.

You must have a disconnected service agent implemented. For information about how to do this, see How to: Create a Disconnected Service Agent.

To update a disconnected service agent

  1. Using Visual Studio, open an existing smart client solution.
  2. Build the solution.
  3. In Solution Explorer, right-click a folder that contains a disconnected service agent, point to Smart Client Factory, and then click Update Disconnected Service Agent, as illustrated in Figure 1.


    Figure 1

    Update Disconnected Service Agent recipe menu item
  4. The recipe wizard appears. This wizard interface is identical to the one that appears for the Create Disconnected Service Agent recipe. On the Properties tab, you will see the methods exposed by the Web service proxy, as illustrated in Figure 2. That means that if you have updated your Web reference, when you run the Update Disconnected Service Agent recipe, the wizard will display any new operations for that service.


    Figure 2

    Properties tab of the Update Disconnected Service Agent recipe wizard
  5. If you updated the source code and changed the default behavior in the Agent class, the recipe wizard will display the modified values, as illustrated in Figure 3.


    Figure 3

    Update Disconnected Service Agent displaying modified values
  6. Click Finish. The wizard will update the disconnected service agent.
Note: When you update a disconnected service agent, the recipe updates the abstract base class CallbackBase to reflect new or removed operations, changed parameters, or modified returned types. The recipe does not modify the derived class, Callback (this class contains your application-specific logic). This means that after you run the recipe, your solution will not compile if the Callback class does not match the operations specified in the updated CallbackBase class. In that case, you must update the Callback file to handle the operations as defined in the CallbackBase class.

You will have an updated service agent that consumes a proxy that matches the updated service.