WF4: Host No-service Workflow

Source: Internet
Author: User

When using a workflow service, we typically use message activities such as receive in the workflow design and then host using WorkflowServiceHost, and the workflow cannot accept messages sent if there is no receive activity. This time we can use the Workflowhostingendpoint class:

To host a workflow without a service, you need to inherit workflowhostingendpoint and rewrite Ongetinstanceid,ongetcreationcontext,onresolvebookmark. First we declare a service contract, which contains a service operation that creates a new instance, which passes a idictionary<string,object> parameter implicitly implemented by Workflowhostingendpoint. When this workflow is hosted, it is added using the WorkflowServiceHost AddServiceEndpoint method. The following examples illustrate:

1. The following is the project structure:

2. Define the service contract first, as follows:

[ServiceContract(Name = "IWorkflowCreation")]
public interface IWorkflowCreation
{
         [OperationContract(Name = "Create")]
         Guid Create(IDictionary<string, object> inputs);
         [OperationContract(Name = "CreateWithInstanceId", IsOneWay = true)]
         void CreateWithInstanceId(Guid instanceId, IDictionary<string, object> inputs);
         [OperationContract(Name = "ResumeBookmark", IsOneWay = true)]
         void ResumeBookmark(Guid instanceId, string bookmarkName, string message);
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.