From 66f960ba4c0a5f53322606b2c5942e4203a6142f Mon Sep 17 00:00:00 2001 From: malik masis Date: Thu, 24 Mar 2022 12:43:23 +0300 Subject: [PATCH] Added AbpDistributedLockingAbstractionsModule Also removed swagger and DistributedLock.Redis dependencies --- .../EfCore/PendingEfCoreMigrationsChecker.cs | 2 +- .../EShopOnAbp.Shared.Hosting.Microservices.csproj | 2 -- .../EShopOnAbpSharedHostingMicroservicesModule.cs | 13 +++---------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs b/shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs index 15e01e67..f43f3aee 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs @@ -49,7 +49,6 @@ public abstract class PendingEfCoreMigrationsChecker : PendingMigrat await using (var handle = await DistributedLockProvider.TryAcquireAsync("Migration_" + DatabaseName)) { Log.Information($"Lock is acquired for db migration and seeding on database named: {DatabaseName}..."); - using (CurrentTenant.Change(null)) { // Create database tables if needed @@ -72,6 +71,7 @@ public abstract class PendingEfCoreMigrationsChecker : PendingMigrat await ServiceProvider.GetRequiredService() .SeedAsync(); } + Log.Information($"Lock is released for db migration and seeding on database named: {DatabaseName}..."); } } } \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj index 948da22e..5dacf9d2 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj @@ -9,10 +9,8 @@ - - diff --git a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs index ad58eef3..07f49478 100644 --- a/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs +++ b/shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs @@ -1,7 +1,5 @@ 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; @@ -9,6 +7,7 @@ using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.BackgroundJobs.RabbitMQ; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.DistributedLocking; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; @@ -21,7 +20,8 @@ namespace EShopOnAbp.Shared.Hosting.Microservices; typeof(AbpAspNetCoreMultiTenancyModule), typeof(AbpEventBusRabbitMqModule), typeof(AbpCachingStackExchangeRedisModule), - typeof(AdministrationServiceEntityFrameworkCoreModule) + typeof(AdministrationServiceEntityFrameworkCoreModule), + typeof(AbpDistributedLockingAbstractionsModule) )] public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule { @@ -43,12 +43,5 @@ public class EShopOnAbpSharedHostingMicroservicesModule : AbpModule context.Services .AddDataProtection() .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); - - - context.Services.AddSingleton(sp => - { - var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); - return new RedisDistributedSynchronizationProvider(connection.GetDatabase()); - }); } } \ No newline at end of file