Updated .NET workflow method names (#4586)

* Updated .NET workflow method names

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

* Fixed incorrect .NET method name for purging workflow instances

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>

---------

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
Whit Waldo 2025-04-12 17:52:38 -05:00 committed by GitHub
parent 04c9b586e0
commit f83e3dc9ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 11 deletions

View File

@ -138,31 +138,29 @@ Manage your workflow within your code. In the `OrderProcessingWorkflow` example
```csharp
string orderId = "exampleOrderId";
string workflowComponent = "dapr";
string workflowName = "OrderProcessingWorkflow";
OrderPayload input = new OrderPayload("Paperclips", 99.95);
Dictionary<string, string> workflowOptions; // This is an optional parameter
// Start the workflow. This returns back a "StartWorkflowResponse" which contains the instance ID for the particular workflow instance.
StartWorkflowResponse startResponse = await daprClient.StartWorkflowAsync(orderId, workflowComponent, workflowName, input, workflowOptions);
// 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.
await daprWorkflowClient.ScheduleNewWorkflowAsync(nameof(OrderProcessingWorkflow), orderId, input, workflowOptions);
// Get information on the workflow. This response contains information such as the status of the workflow, when it started, and more!
GetWorkflowResponse getResponse = await daprClient.GetWorkflowAsync(orderId, workflowComponent, eventName);
WorkflowState currentState = await daprWorkflowClient.GetWorkflowStateAsync(orderId, orderId);
// Terminate the workflow
await daprClient.TerminateWorkflowAsync(orderId, workflowComponent);
await daprWorkflowClient.TerminateWorkflowAsync(orderId);
// Raise an event (an incoming purchase order) that your workflow will wait for. This returns the item waiting to be purchased.
await daprClient.RaiseWorkflowEventAsync(orderId, workflowComponent, workflowName, input);
// Raise an event (an incoming purchase order) that your workflow will wait for
await daprWorkflowClient.RaiseEventAsync(orderId, "incoming-purchase-order", input);
// Pause
await daprClient.PauseWorkflowAsync(orderId, workflowComponent);
await daprWorkflowClient.SuspendWorkflowAsync(orderId);
// Resume
await daprClient.ResumeWorkflowAsync(orderId, workflowComponent);
await daprWorkflowClient.ResumeWorkflowAsync(orderId);
// Purge the workflow, removing all inbox and history information from associated instance
await daprClient.PurgeWorkflowAsync(orderId, workflowComponent);
await daprWorkflowClient.PurgeInstanceAsync(orderId);
```
{{% /codetab %}}