mirror of https://github.com/abpframework/abp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
using Medallion.Threading;
|
|
using Medallion.Threading.Redis;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using StackExchange.Redis;
|
|
using Volo.Abp.Autofac;
|
|
using Volo.Abp.Domain;
|
|
using Volo.Abp.Domain.Entities.Events.Distributed;
|
|
using Volo.Abp.EventBus.Boxes;
|
|
using Volo.Abp.Modularity;
|
|
|
|
namespace DistDemoApp
|
|
{
|
|
[DependsOn(
|
|
typeof(AbpAutofacModule),
|
|
typeof(AbpDddDomainModule),
|
|
typeof(AbpEventBusBoxesModule)
|
|
)]
|
|
public class DistDemoAppSharedModule : AbpModule
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
var configuration = context.Services.GetConfiguration();
|
|
|
|
context.Services.AddHostedService<DistDemoAppHostedService>();
|
|
|
|
Configure<AbpDistributedEntityEventOptions>(options =>
|
|
{
|
|
options.EtoMappings.Add<TodoItem, TodoItemEto>();
|
|
options.AutoEventSelectors.Add<TodoItem>();
|
|
});
|
|
|
|
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
|
|
{
|
|
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
|
|
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
|
|
});
|
|
}
|
|
}
|
|
} |