Share via


Building a DCS Task

A DCS task is the implementation of a DCS operation. When you create an operation by using the BLSpecific project type, the operation wizard automatically creates the envelope and workflow classes that are required to implement the task functionality.

If you create a DCS Stub project to define the service contract and then add operations to that project, you must implement the task functionality in a separate project. The WFTask project template lets you implement service operations in a separate assembly, creating a loosely coupled solution in which you have more granular control over which tasks respond to which services. When you implement a task in a WFTask project, Visual Studio generates template envelope and workflow classes. The envelope class is effectively a wrapper around the workflow class. The code in the class creates an instance of a WorkflowHost object in which the workflow executes. The workflow class is a standard .NET workflow, with no special requirements or functionality.

To create a WFTask project

  1. In your DCS solution, right-click the WFTask folder, point to Add, and then click WFTask.
  2. In the Add New Project dialog box, make sure that the WFTask template is selected, provide a name and location for the project, and then click OK.
  3. In the Create New WF Task Project dialog box, on the Assembly and Class page, provide a namespace for the project, and then click Finish.

After you create a task project, you can add operations to the project to build your service operation contract.

To add a task that implements an operation

  1. Right-click the WFTask project node, and then click Add WF Operation.

  2. In the Add New WF Operation dialog box, on the Assembly or Project page, click the ellipsis button.

  3. In the Please choose a file dialog box, browse to the location of the stub assembly that defines the operation that you want to implement. Click the assembly file, and then click Open.

  4. In the Add New WF Operation dialog box, click Next.

  5. On the Operation to Implement page, in the Selectoperation to implement list, click the name of the operation that you want the new task to implement.

  6. On the WF Assemblies References Selector page, click Finish to create the new task implementation.

  7. Note

    The Add New Operation dialog box does not request details of the message types to use in the task implementation. Message types are defined in the operation, rather than in the task; therefore, the message types are derived from the operation definition.

  8. Use the task workflow to implement the business logic for the task.

See Also

Building a DCS Stub

Walkthrough: Implementing a DCS Task