Browse Source

Re-added the distributed lock library.

pull/100/head
Halil İbrahim Kalkan 4 years ago
parent
commit
3416a560eb
  1. 3
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj
  2. 10
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs

3
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj

@ -19,6 +19,9 @@
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="5.1.2" />
<PackageReference Include="Volo.Abp.BackgroundJobs.RabbitMQ" Version="5.1.2" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="5.1.2" />
<PackageReference Include="Volo.Abp.DistributedLocking" Version="5.1.2" />
<PackageReference Include="DistributedLock.Redis" Version="1.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>

10
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs

@ -1,5 +1,7 @@
using EShopOnAbp.AdministrationService.EntityFrameworkCore;
using EShopOnAbp.Shared.Hosting.AspNetCore;
using Medallion.Threading;
using Medallion.Threading.Redis;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
@ -21,7 +23,7 @@ namespace EShopOnAbp.Shared.Hosting.Microservices;
typeof(AbpEventBusRabbitMqModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AdministrationServiceEntityFrameworkCoreModule),
typeof(AbpDistributedLockingAbstractionsModule)
typeof(AbpDistributedLockingModule)
)]
public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule
{
@ -43,5 +45,11 @@ public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys");
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
{
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
});
}
}
Loading…
Cancel
Save