Skip to content
21 changes: 21 additions & 0 deletions daprdocs/content/en/dotnet-sdk-docs/dotnet-client/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,33 @@ await foreach (var items in subscribeConfigurationResponse.Source.WithCancellati
}
```

### Manage workflow instances (Alpha)

```csharp
var daprClient = new DaprClientBuilder().Build();

string instanceId = "MyWorkflowInstance1";
string workflowComponentName = "dapr"; // alternatively, this could be the name of a workflow component defined in yaml
string workflowName = "MyWorkflowDefinition";
var input = new { name = "Billy", age = 30 }; // Any JSON-serializable value is OK

// Start workflow
Copy link
Copy Markdown
Contributor

@RyanLettieri RyanLettieri Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string instanceId;
string workflowComponentName;
string workflowName;
object input ;

It might be helpful to add all of these above "//Start workflow" to give the user a better idea as to what variable types everything is.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't bother with a CancellationToken cts local variable. Just pass CancellationToken.None directly as the last input of StartWorkflowAsync.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're using CancellationToken.None I'd rather just use the default variable. I worry that this implies that you have to use a CancellationToken instead of having it as optional.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good point. In that case, let’s remove both the options variable and the cancellation token.

var startResponse = await daprClient.StartWorkflowAsync(instanceId, workflowComponentName, workflowName, input);

// Terminate workflow
await daprClient.TerminateWorkflowAsync(instanceId, workflowComponentName);

// Get workflow metadata
var getResponse = await daprClient.GetWorkflowAsync(instanceId, workflowComponentName, workflowName);
```

## Sidecar APIs
### Sidecar Health
The .NET SDK provides a way to poll for the sidecar health, as well as a convenience method to wait for the sidecar to be ready.

#### Poll for health
This health endpoint returns true when both the sidecar and your application are up (fully initialized).

```csharp
var client = new DaprClientBuilder().Build();

Expand Down