diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln
index 5578e2d7c3..f6eba4386d 100644
--- a/framework/Volo.Abp.sln
+++ b/framework/Volo.Abp.sln
@@ -419,6 +419,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Dapr",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Dapr.EventBus", "src\Volo.Abp.AspNetCore.Dapr.EventBus\Volo.Abp.AspNetCore.Dapr.EventBus.csproj", "{B02EF042-C39E-45C4-A92D-BF7554E1889D}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.DistributedLocking.Dapr", "src\Volo.Abp.DistributedLocking.Dapr\Volo.Abp.DistributedLocking.Dapr.csproj", "{CAE48068-233C-47A9-BEAB-DDF521730E7A}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1249,6 +1251,10 @@ Global
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B02EF042-C39E-45C4-A92D-BF7554E1889D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CAE48068-233C-47A9-BEAB-DDF521730E7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CAE48068-233C-47A9-BEAB-DDF521730E7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CAE48068-233C-47A9-BEAB-DDF521730E7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CAE48068-233C-47A9-BEAB-DDF521730E7A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1460,6 +1466,7 @@ Global
{18B796D2-D45D-41AE-9A42-75C9B14B20DF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{5EED625D-8D86-492A-BCB8-F6C8CD8D4AA1} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{B02EF042-C39E-45C4-A92D-BF7554E1889D} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
+ {CAE48068-233C-47A9-BEAB-DDF521730E7A} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}
diff --git a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs
index e6919783af..9d743263c5 100644
--- a/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs
+++ b/framework/src/Volo.Abp.Dapr/Volo/Abp/Dapr/AbpDaprOptions.cs
@@ -2,6 +2,8 @@
public class AbpDaprOptions
{
+ public string AppId { get; set; }
+
public string HttpEndpoint { get; set; }
public string GrpcEndpoint { get; set; }
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xml b/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xml
new file mode 100644
index 0000000000..00e1d9a1c1
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xsd b/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xsd
new file mode 100644
index 0000000000..3f3946e282
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj
new file mode 100644
index 0000000000..80cad677a3
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo.Abp.DistributedLocking.Dapr.csproj
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs
new file mode 100644
index 0000000000..a2ff732932
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockDaprOptions.cs
@@ -0,0 +1,6 @@
+namespace Volo.Abp.DistributedLocking.Dapr;
+
+public class AbpDistributedLockDaprOptions
+{
+ public string StoreName { get; set; }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockingDaprModule.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockingDaprModule.cs
new file mode 100644
index 0000000000..c915cfe2f7
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/AbpDistributedLockingDaprModule.cs
@@ -0,0 +1,11 @@
+using Volo.Abp.Dapr;
+using Volo.Abp.Modularity;
+
+namespace Volo.Abp.DistributedLocking.Dapr;
+
+[DependsOn(
+ typeof(AbpDistributedLockingAbstractionsModule),
+ typeof(AbpDaprModule))]
+public class AbpDistributedLockingDaprModule : AbpModule
+{
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs
new file mode 100644
index 0000000000..d74d7497fc
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLock.cs
@@ -0,0 +1,50 @@
+using Microsoft.Extensions.Options;
+using Volo.Abp.Dapr;
+using Volo.Abp.DependencyInjection;
+
+namespace Volo.Abp.DistributedLocking.Dapr;
+
+[Dependency(ReplaceServices = true)]
+public class DaprAbpDistributedLock : IAbpDistributedLock, ITransientDependency
+{
+ protected AbpDaprClientFactory DaprClientFactory { get; }
+ protected AbpDistributedLockDaprOptions DistributedLockDaprOptions { get; }
+ protected AbpDaprOptions DaprOptions { get; }
+
+ public DaprAbpDistributedLock(
+ AbpDaprClientFactory daprClientFactory,
+ IOptions distributedLockDaprOptions,
+ IOptions daprOptions)
+ {
+ DaprClientFactory = daprClientFactory;
+ DaprOptions = daprOptions.Value;
+ DistributedLockDaprOptions = distributedLockDaprOptions.Value;
+ }
+
+ public async Task TryAcquireAsync(
+ string name,
+ TimeSpan timeout = default,
+ CancellationToken cancellationToken = default)
+ {
+ if (timeout == default)
+ {
+ timeout = TimeSpan.FromSeconds(30);
+ }
+
+ var daprClient = await DaprClientFactory.CreateAsync();
+
+ var lockResponse = await daprClient.Lock(
+ DistributedLockDaprOptions.StoreName,
+ name,
+ DaprOptions.AppId,
+ timeout.Seconds,
+ cancellationToken);
+
+ if (lockResponse == null || !lockResponse.Success)
+ {
+ return null;
+ }
+
+ return new DaprAbpDistributedLockHandle(lockResponse);
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs
new file mode 100644
index 0000000000..b10f0f3672
--- /dev/null
+++ b/framework/src/Volo.Abp.DistributedLocking.Dapr/Volo/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs
@@ -0,0 +1,18 @@
+using Dapr.Client;
+
+namespace Volo.Abp.DistributedLocking.Dapr;
+
+public class DaprAbpDistributedLockHandle : IAbpDistributedLockHandle
+{
+ protected TryLockResponse LockResponse { get; }
+
+ public DaprAbpDistributedLockHandle(TryLockResponse lockResponse)
+ {
+ LockResponse = lockResponse;
+ }
+
+ public async ValueTask DisposeAsync()
+ {
+ await LockResponse.DisposeAsync();
+ }
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/AbpDistributedLockingModule.cs b/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/AbpDistributedLockingModule.cs
index 4c4abd3f32..c642e33667 100644
--- a/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/AbpDistributedLockingModule.cs
+++ b/framework/src/Volo.Abp.DistributedLocking/Volo/Abp/DistributedLocking/AbpDistributedLockingModule.cs
@@ -7,5 +7,4 @@ namespace Volo.Abp.DistributedLocking;
)]
public class AbpDistributedLockingModule : AbpModule
{
-
}
diff --git a/nupkg/common.ps1 b/nupkg/common.ps1
index a2df36ae42..65e2d46324 100644
--- a/nupkg/common.ps1
+++ b/nupkg/common.ps1
@@ -164,6 +164,7 @@ $projects = (
"framework/src/Volo.Abp.Ddd.Domain",
"framework/src/Volo.Abp.DistributedLocking.Abstractions",
"framework/src/Volo.Abp.DistributedLocking",
+ "framework/src/Volo.Abp.DistributedLocking.Dapr",
"framework/src/Volo.Abp.Emailing",
"framework/src/Volo.Abp.EntityFrameworkCore",
"framework/src/Volo.Abp.EntityFrameworkCore.MySQL",