<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dapr State Management .NET SDK on Dapr Docs</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/</link><description>Recent content in Dapr State Management .NET SDK on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/index.xml" rel="self" type="application/rss+xml"/><item><title>How to: Manage state with the Dapr State Management .NET SDK</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/dotnet-statemanagement-howto/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/dotnet-statemanagement-howto/</guid><description>&lt;p>Let&amp;rsquo;s walk through how to manage state using the &lt;code>Dapr.StateManagement&lt;/code> package. We&amp;rsquo;ll use the
&lt;a href="https://github.com/dapr/dotnet-sdk/tree/master/examples/StateManagement">sample project provided here&lt;/a> for the following demonstration, covering typed state store clients via the source generator, direct client usage for bulk operations and transactions, and optimistic concurrency control with ETags. In this guide, you will:&lt;/p>
&lt;ul>
&lt;li>Deploy a .NET application (&lt;a href="https://github.com/dapr/dotnet-sdk/tree/master/examples/StateManagement/StateManagementExample">StateManagementExample&lt;/a>)&lt;/li>
&lt;li>Utilize the Dapr .NET State Management SDK to save, retrieve, and delete state entries&lt;/li>
&lt;li>Use ETags for optimistic concurrency control&lt;/li>
&lt;li>Perform bulk operations and state transactions&lt;/li>
&lt;li>Use the source generator to create a strongly-typed, store-scoped interface&lt;/li>
&lt;/ul>
&lt;p>In the .NET example project:&lt;/p></description></item><item><title>DaprStateManagementClient usage</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/dotnet-statemanagementclient-usage/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-state-management/dotnet-statemanagementclient-usage/</guid><description>&lt;h2 id="lifetime-management">Lifetime management&lt;/h2>
&lt;p>A &lt;code>DaprStateManagementClient&lt;/code> holds long-lived network resources (gRPC channels, HTTP connections). For best performance:&lt;/p>
&lt;ul>
&lt;li>Register a single shared instance and reuse it for the lifetime of the application.&lt;/li>
&lt;li>Avoid creating and disposing a client per operation — this can lead to socket exhaustion.&lt;/li>
&lt;li>The DI registration via &lt;code>AddDaprStateManagementClient()&lt;/code> defaults to &lt;code>ServiceLifetime.Singleton&lt;/code>, which is the recommended approach for most applications.&lt;/li>
&lt;/ul>
&lt;p>The client is thread-safe and can be shared across concurrent requests.&lt;/p></description></item></channel></rss>