项目文件夹

文件
wehub-resource-sync a9cd7750f4
CI / unit-test (push) Has been cancelled
CI / detect-changes (push) Has been cancelled
CI / build (push) Has been cancelled
Publish docs via GitHub Pages / Deploy docs (push) Has been cancelled
CI / test-harness (push) Has been cancelled
CI / generate-e2e-matrix (push) Has been cancelled
CI / e2e (push) Has been cancelled
CI / build-ui (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
UI v2 Integration CI / E2E (Integration) (push) Has been cancelled
UI v2 CI / Lint, Format & Test (push) Has been cancelled
UI v2 CI / E2E (Mocked) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:37:56 +08:00

75 行
2.7 KiB
Markdown

此文件含有不可见的 Unicode 字符
此文件含有人类无法区分的不可见的 Unicode 字符,但可以由计算机进行不同的处理。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
---
description: "Build Conductor workers in C#/.NET with dependency injection, workflow management, and task polling."
---
# C# SDK
!!! info "Source"
GitHub: [conductor-oss/csharp-sdk](https://github.com/conductor-oss/csharp-sdk) | Report issues and contribute on GitHub.
## ⭐ Conductor OSS
Show support for the Conductor OSS. Please help spread the awareness by starring Conductor repo.
[![GitHub stars](https://img.shields.io/github/stars/conductor-oss/conductor.svg?style=social&label=Star&maxAge=)](https://GitHub.com/conductor-oss/conductor/)
### Setup Conductor C# Package
```shell
dotnet add package conductor-csharp
```
## Configurations
### Authentication Settings (Optional)
Configure the authentication settings if your Conductor server requires authentication.
* keyId: Key for authentication.
* keySecret: Secret for the key.
```csharp
authenticationSettings: new OrkesAuthenticationSettings(
KeyId: "key",
KeySecret: "secret"
)
```
### Access Control Setup
See [Access Control](https://orkes.io/content/docs/getting-started/concepts/access-control) for more details on role-based access control with Conductor and generating API keys for your environment.
### Configure API Client
```csharp
using Conductor.Api;
using Conductor.Client;
using Conductor.Client.Authentication;
var configuration = new Configuration() {
BasePath = basePath,
AuthenticationSettings = new OrkesAuthenticationSettings("keyId", "keySecret")
};
var workflowClient = configuration.GetClient<WorkflowResourceApi>();
workflowClient.StartWorkflow(
name: "test-sdk-csharp-workflow",
body: new Dictionary<string, object>(),
version: 1
)
```
### Next: [Create and run task workers](https://github.com/conductor-sdk/conductor-csharp/blob/main/docs/readme/workers.md)
## Examples
Browse all examples on GitHub: [conductor-oss/csharp-sdk/csharp-examples](https://github.com/conductor-oss/csharp-sdk/tree/main/csharp-examples)
| Example | Type |
|---|---|
| [Examples](https://github.com/conductor-oss/csharp-sdk/tree/main/csharp-examples/Examples) | directory |
| [Humantaskexamples](https://github.com/conductor-oss/csharp-sdk/blob/main/csharp-examples/HumanTaskExamples.cs) | file |
| [Program](https://github.com/conductor-oss/csharp-sdk/blob/main/csharp-examples/Program.cs) | file |
| [Runner](https://github.com/conductor-oss/csharp-sdk/blob/main/csharp-examples/Runner.cs) | file |
| [Testworker](https://github.com/conductor-oss/csharp-sdk/blob/main/csharp-examples/TestWorker.cs) | file |
| [Utils](https://github.com/conductor-oss/csharp-sdk/tree/main/csharp-examples/Utils) | directory |
| [Workflowexamples](https://github.com/conductor-oss/csharp-sdk/blob/main/csharp-examples/WorkFlowExamples.cs) | file |