How to: Update a Disconnected Service Agent
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
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
- Using Visual Studio, open an existing smart client solution.
- Build the solution.
- 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.
Update Disconnected Service Agent recipe menu item
- 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.
Properties tab of the Update Disconnected Service Agent recipe wizard
- 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.
Update Disconnected Service Agent displaying modified values
- Click Finish. The wizard will update the disconnected service agent.
|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.|