Starts in:
1 DAY
15 HRS
3 MIN
21 SEC
Starts in:
1 D
15 H
3 M
21 S
Open Closed

About identity user management or identity user service #2735


User avatar
0
ldacnfinit created
  • ABP Framework version: v4.4.3

  • UI type: Angular

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes

  • Exception message and stack trace: If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.Object name: 'IdentityDbContext'.

  • Steps to reproduce the issue:"

[UnitOfWork]
public virtual async Task<ListResultDto<AppUserDto>> ImportByExcelFile(IFormFile file)
{
    ...
    await _identityUserManager.CreateAsync(ObjectMapper.Map<CreateUpdateAppUserDto, IdentityUser>(s), userPwd, false);
    ...
}

4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share full error info.

  • User Avatar
    0
    ldacnfinit created

    hi

    Please share full error info.

    Because the number of log words exceeded the maximum allowed for a post, I posted a blog with a link to https://www.cnblogs.com/zinan/p/16007487.html

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Hi @ldacnfinit, can you try to create a UOW in your ImportByExcelFile method manually, like below:

    
    private readonly IUnitOfWorkManager _unitOfWorkManager;
    
    public virtual async Task> ImportByExcelFile(IFormFile file) 
    {
         using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
         {
          //...
          
          await _identityUserManager.CreateAsync(ObjectMapper.Map(s), userPwd, false);
          
          await uow.CompleteAsync();
         }
    }
    

    https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

  • User Avatar
    0
    ldacnfinit created

    Hi @ldacnfinit, can you try to create a UOW in your ImportByExcelFile method manually, like below:

     
    private readonly IUnitOfWorkManager _unitOfWorkManager; 
     
    public virtual async Task> ImportByExcelFile(IFormFile file)  
    { 
         using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) 
         { 
          //... 
           
          await _identityUserManager.CreateAsync(ObjectMapper.Map(s), userPwd, false); 
           
          await uow.CompleteAsync(); 
         } 
    } 
    

    https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work

    Ok, Thanks a lot! It works!

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06