Open Closed

can not use UserLookupService to obtain user information in tenant #3176


User avatar
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);
        }
    }
}

}`

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    chenxm created

    This is not a problem

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.