mirror of https://github.com/dapr/docs.git
add dotnet sdk example and set up tabs
Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
This commit is contained in:
parent
378d85a6cb
commit
86fdd45481
|
@ -28,10 +28,12 @@ Refer to the TTL column in the [state store components guide]({{< ref supported-
|
|||
|
||||
You can set state TTL in the metadata as part of the state store set request:
|
||||
|
||||
{{< tabs Python "HTTP API (Bash)" "HTTP API (PowerShell)">}}
|
||||
{{< tabs Python ".NET" Java Go "HTTP API (Bash)" "HTTP API (PowerShell)">}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
<!--python-->
|
||||
|
||||
```python
|
||||
#dependencies
|
||||
|
||||
|
@ -58,6 +60,73 @@ dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-g
|
|||
|
||||
{{% codetab %}}
|
||||
|
||||
<!--dotnet-->
|
||||
|
||||
```csharp
|
||||
// dependencies
|
||||
|
||||
using Dapr.Client;
|
||||
|
||||
// code
|
||||
|
||||
await client.SaveStateAsync(storeName, stateKeyName, state, metadata: new Dictionary<string, string>() {
|
||||
{
|
||||
"metadata.ttlInSeconds", "120"
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
To launch a Dapr sidecar and run the above example application, you'd then run a command similar to the following:
|
||||
|
||||
```bash
|
||||
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
<!--java-->
|
||||
|
||||
```java
|
||||
//dependencies
|
||||
|
||||
|
||||
//code
|
||||
|
||||
|
||||
```
|
||||
|
||||
To launch a Dapr sidecar and run the above example application, you'd then run a command similar to the following:
|
||||
|
||||
```bash
|
||||
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
<!--go-->
|
||||
|
||||
```go
|
||||
// dependencies
|
||||
|
||||
|
||||
// code
|
||||
|
||||
```
|
||||
|
||||
To launch a Dapr sidecar and run the above example application, you'd then run a command similar to the following:
|
||||
|
||||
```bash
|
||||
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
|
||||
```
|
||||
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" -d '[{ "key": "order_1", "value": "250", "metadata": { "ttlInSeconds": "120" } }]' http://localhost:3601/v1.0/state/statestore
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue