<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dapr Distributed Lock .NET SDK on Dapr Docs</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-distributed-lock/</link><description>Recent content in Dapr Distributed Lock .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-distributed-lock/index.xml" rel="self" type="application/rss+xml"/><item><title>How to: Create and use Dapr Distributed Lock in the .NET SDK</title><link>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-distributed-lock/dotnet-distributedlock-howto/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-distributed-lock/dotnet-distributedlock-howto/</guid><description>&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://dotnet.microsoft.com/download/dotnet/8.0">.NET 8&lt;/a>,
&lt;a href="https://dotnet.microsoft.com/download/dotnet/9.0">.NET 9&lt;/a>, or
&lt;a href="https://dotnet.microsoft.com/download/dotnet/10.0">.NET 10&lt;/a> installed&lt;/li>
&lt;li>&lt;a href="https://docs.dapr.io/getting-started/install-dapr-cli/">Dapr CLI&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.dapr.io/getting-started/install-dapr-selfhost">Initialized Dapr environment&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;p>To get started with the Dapr Distributed lock .NET SDK client, install the &lt;a href="https://www.nuget.org/packages/Dapr.DistributedLock">Dapr.Distributed Lock package&lt;/a> from NuGet:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-sh" data-lang="sh">&lt;span style="display:flex;">&lt;span>dotnet add package Dapr.DistributedLock
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>A &lt;code>DaprDistributedLockClient&lt;/code> maintains access to networking resources in the form of TCP sockets used to communicate with the Dapr sidecar.&lt;/p>
&lt;h3 id="dependency-injection">Dependency Injection&lt;/h3>
&lt;p>The &lt;code>AddDaprDistributedLock()&lt;/code> method will register the Dapr client ASP.NET Core dependency injection and is the recommended approach
for using this package. This method accepts an optional options delegate for configuring the &lt;code>DaprDistributedLockClient&lt;/code> and a
&lt;code>ServiceLifetime&lt;/code> argument, allowing you to specify a different lifetime for the registered services instead of the default &lt;code>Singleton&lt;/code>
value.&lt;/p></description></item></channel></rss>