0
chenxm created
- ABP Framework version: v5.3.0-rc.2
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
- Steps to reproduce the issue:"
I have a microservice solution that is generated from a template. I want to synchronize redundant user information in one of the services. I refer to this information:
https://github.com/abpframework/abp/tree/dev/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Users
When the host creates a new user, the user information can be obtained synchronously. When I was in tenant, I couldn't get it.
`public class WorkUserSynchronizer : IDistributedEventHandler<EntityUpdatedEto
private readonly IWorkUserRepository _workUserRepo;
private readonly IWorkUserLookupService _workUserLookupService;
private readonly ILogger<WorkUserSynchronizer> _logger;
public WorkUserSynchronizer(
ICurrentTenant currentTenant,
IWorkUserRepository workUserRepo,
IWorkUserLookupService workUserLookupService,
ILogger<WorkUserSynchronizer> logger)
{
_currentTenant = currentTenant;
_workUserRepo = workUserRepo;
_workUserLookupService = workUserLookupService;
_logger = logger;
}
public async Task HandleEventAsync(EntityUpdatedEto<UserEto> eventData)
{
_logger.LogInformation("user updated: {0}", eventData.Entity.Id);
using (_currentTenant.Change(eventData.Entity.TenantId))
{
var user = await _workUserRepo.FindAsync(eventData.Entity.Id);
if (null == user)
{
user = await _workUserLookupService.FindByIdAsync(eventData.Entity.Id);
if (null == user)
{
return;
}
}
if (user.Update(eventData.Entity))
{
await _workUserRepo.UpdateAsync(user);
}
}
}
}`