@@ -138,31 +138,29 @@ Manage your workflow within your code. In the `OrderProcessingWorkflow` example
138
138
139
139
``` csharp
140
140
string orderId = " exampleOrderId" ;
141
- string workflowComponent = " dapr" ;
142
- string workflowName = " OrderProcessingWorkflow" ;
143
141
OrderPayload input = new OrderPayload (" Paperclips" , 99 . 95 );
144
142
Dictionary < string , string > workflowOptions ; // This is an optional parameter
145
143
146
- // Start the workflow. This returns back a "StartWorkflowResponse" which contains the instance ID for the particular workflow instance.
147
- StartWorkflowResponse startResponse = await daprClient . StartWorkflowAsync ( orderId , workflowComponent , workflowName , input , workflowOptions );
144
+ // Start the workflow using the orderId as our workflow ID . This returns a string containing the instance ID for the particular workflow instance, whether we provide it ourselves or not .
145
+ await daprWorkflowClient . ScheduleNewWorkflowAsync ( nameof ( OrderProcessingWorkflow ), orderId , input , workflowOptions );
148
146
149
147
// Get information on the workflow. This response contains information such as the status of the workflow, when it started, and more!
150
- GetWorkflowResponse getResponse = await daprClient . GetWorkflowAsync (orderId , workflowComponent , eventName );
148
+ WorkflowState currentState = await daprWorkflowClient . GetWorkflowStateAsync (orderId , orderId );
151
149
152
150
// Terminate the workflow
153
- await daprClient .TerminateWorkflowAsync (orderId , workflowComponent );
151
+ await daprWorkflowClient .TerminateWorkflowAsync (orderId );
154
152
155
- // Raise an event (an incoming purchase order) that your workflow will wait for. This returns the item waiting to be purchased.
156
- await daprClient . RaiseWorkflowEventAsync (orderId , workflowComponent , workflowName , input );
153
+ // Raise an event (an incoming purchase order) that your workflow will wait for
154
+ await daprWorkflowClient . RaiseEventAsync (orderId , " incoming-purchase-order " , input );
157
155
158
156
// Pause
159
- await daprClient . PauseWorkflowAsync (orderId , workflowComponent );
157
+ await daprWorkflowClient . SuspendWorkflowAsync (orderId );
160
158
161
159
// Resume
162
- await daprClient .ResumeWorkflowAsync (orderId , workflowComponent );
160
+ await daprWorkflowClient .ResumeWorkflowAsync (orderId );
163
161
164
162
// Purge the workflow, removing all inbox and history information from associated instance
165
- await daprClient . PurgeWorkflowAsync (orderId , workflowComponent );
163
+ await daprWorkflowClient . PurgeInstanceAsync (orderId );
166
164
```
167
165
168
166
{{% /codetab %}}
0 commit comments