Browse Source

Added AbpDistributedLockingAbstractionsModule

Also removed swagger and DistributedLock.Redis dependencies
pull/90/head
malik masis 5 years ago
parent
commit
66f960ba4c
  1. 2
      shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs
  2. 2
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbp.Shared.Hosting.Microservices.csproj
  3. 13
      shared/EShopOnAbp.Shared.Hosting.Microservices/EShopOnAbpSharedHostingMicroservicesModule.cs

2
shared/EShopOnAbp.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs

@ -49,7 +49,6 @@ public abstract class PendingEfCoreMigrationsChecker<TDbContext> : 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<TDbContext> : PendingMigrat
await ServiceProvider.GetRequiredService<IDataSeeder>()
.SeedAsync();
}
Log.Information($"Lock is released for db migration and seeding on database named: {DatabaseName}...");
}
}
}

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

@ -9,10 +9,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DistributedLock.Redis" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Volo.Abp.MongoDB" Version="5.1.2" />
</ItemGroup>

13
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<IDistributedLockProvider>(sp =>
{
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
});
}
}
Loading…
Cancel
Save