Browse Source
Merge pull request #100 from abpframework/add-dist-lock
Re-added the distributed lock library.
pull/101/head
Enis Necipoglu
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
1 deletions
-
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj
-
shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs
|
|
|
@ -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> |
|
|
|
|
|
|
|
@ -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()); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |