diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
index 6d1cf200e5..47e3d8abfc 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyCompanyName.MyProjectName.AuthServer.csproj
@@ -34,6 +34,7 @@
+
@@ -48,6 +49,7 @@
+
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
index 57d4d22992..53a4a95786 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.AuthServer/MyProjectNameAuthServerModule.cs
@@ -2,6 +2,8 @@ using System;
using System.IO;
using System.Linq;
using Localization.Resources.AbpUi;
+using Medallion.Threading;
+using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection;
@@ -153,6 +155,13 @@ public class MyProjectNameAuthServerModule : AbpModule
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
+
+ context.Services.AddSingleton(sp =>
+ {
+ var connection = ConnectionMultiplexer
+ .Connect(configuration["Redis:Configuration"]);
+ return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
+ });
context.Services.AddCors(options =>
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj
index 60a62cafbe..91dab1bff0 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyCompanyName.MyProjectName.Blazor.Server.Tiered.csproj
@@ -18,6 +18,7 @@
+
@@ -35,6 +36,7 @@
+
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs
index b8c91610b9..b704418fbd 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs
@@ -2,6 +2,8 @@
using System.IO;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
+using Medallion.Threading;
+using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
@@ -96,6 +98,7 @@ public class MyProjectNameBlazorModule : AbpModule
ConfigureRouter(context);
ConfigureMenu(configuration);
ConfigureDataProtection(context, configuration, hostingEnvironment);
+ ConfigureDistributedLocking(context, configuration);
ConfigureSwaggerServices(context.Services);
}
@@ -290,6 +293,18 @@ public class MyProjectNameBlazorModule : AbpModule
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}
+
+ private void ConfigureDistributedLocking(
+ ServiceConfigurationContext context,
+ IConfiguration configuration)
+ {
+ context.Services.AddSingleton(sp =>
+ {
+ var connection = ConnectionMultiplexer
+ .Connect(configuration["Redis:Configuration"]);
+ return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
+ });
+ }
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj
index 800dcbf3da..e33e002731 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj
@@ -14,9 +14,11 @@
+
+
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
index dc32d493b1..457ab77fda 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
@@ -2,6 +2,8 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Medallion.Threading;
+using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors;
@@ -51,6 +53,7 @@ public class MyProjectNameHttpApiHostModule : AbpModule
ConfigureCache(configuration);
ConfigureVirtualFileSystem(context);
ConfigureDataProtection(context, configuration, hostingEnvironment);
+ ConfigureDistributedLocking(context, configuration);
ConfigureCors(context, configuration);
ConfigureSwaggerServices(context, configuration);
}
@@ -158,6 +161,18 @@ public class MyProjectNameHttpApiHostModule : AbpModule
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}
+
+ private void ConfigureDistributedLocking(
+ ServiceConfigurationContext context,
+ IConfiguration configuration)
+ {
+ context.Services.AddSingleton(sp =>
+ {
+ var connection = ConnectionMultiplexer
+ .Connect(configuration["Redis:Configuration"]);
+ return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
+ });
+ }
private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration)
{
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj
index c65609d468..5b12cb50f3 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj
@@ -15,6 +15,7 @@
+
@@ -32,6 +33,7 @@
+
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs
index 2b13b8e49b..beb85d4851 100644
--- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs
+++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs
@@ -1,5 +1,7 @@
using System;
using System.IO;
+using Medallion.Threading;
+using Medallion.Threading.Redis;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
@@ -28,6 +30,7 @@ using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
+using Volo.Abp.DistributedLocking;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Http.Client.Web;
using Volo.Abp.Identity.Web;
@@ -53,6 +56,7 @@ namespace MyCompanyName.MyProjectName.Web;
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpAutofacModule),
typeof(AbpCachingStackExchangeRedisModule),
+ typeof(AbpDistributedLockingModule),
typeof(AbpSettingManagementWebModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpIdentityWebModule),
@@ -83,6 +87,7 @@ public class MyProjectNameWebModule : AbpModule
ConfigureBundles();
ConfigureCache();
ConfigureDataProtection(context, configuration, hostingEnvironment);
+ ConfigureDistributedLocking(context, configuration);
ConfigureUrls(configuration);
ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
@@ -227,6 +232,18 @@ public class MyProjectNameWebModule : AbpModule
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}
+
+ private void ConfigureDistributedLocking(
+ ServiceConfigurationContext context,
+ IConfiguration configuration)
+ {
+ context.Services.AddSingleton(sp =>
+ {
+ var connection = ConnectionMultiplexer
+ .Connect(configuration["Redis:Configuration"]);
+ return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
+ });
+ }
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{