|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
|
|
|
@ -6,7 +7,7 @@ using Volo.Abp.MultiTenancy; |
|
|
|
|
|
|
|
namespace Volo.Abp.EventBus.Distributed |
|
|
|
{ |
|
|
|
public class MySimpleDistributedSingleInstanceEventHandler : IDistributedEventHandler<MySimpleEventData>, IDistributedEventHandler<EntityCreatedEto<MySimpleEventData>>, ITransientDependency |
|
|
|
public class MySimpleDistributedSingleInstanceEventHandler : IDistributedEventHandler<MySimpleEventData>, IDistributedEventHandler<EntityCreatedEto<MySimpleEventData>>, IDistributedEventHandler<MySimpleEto>, ITransientDependency |
|
|
|
{ |
|
|
|
private readonly ICurrentTenant _currentTenant; |
|
|
|
|
|
|
|
@ -28,5 +29,12 @@ namespace Volo.Abp.EventBus.Distributed |
|
|
|
TenantId = _currentTenant.Id; |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
|
|
|
|
public Task HandleEventAsync(MySimpleEto eventData) |
|
|
|
{ |
|
|
|
var tenantIdString = eventData.Properties.GetOrDefault("TenantId").ToString(); |
|
|
|
TenantId = tenantIdString != null ? new Guid(tenantIdString) : _currentTenant.Id; |
|
|
|
return Task.CompletedTask; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|