Open Closed

Entity with recursion - GetListAsync api is not working and not even displaying on index page - Generated using abp suite #6999


User avatar
0
surajlokhandemmew created

ABP Framework version: v8.0.0

UI Type: MVC + Flutter

Database System: MongoDB

Tiered (for MVC) or Auth Server Separated (for Angular): no

Below is the entity with recursion

public abstract class ChatResourceDtoBase : FullAuditedEntityDto<Guid>, IHasConcurrencyStamp
{
    public string? ChipTitle { get; set; }
    public string? ChipTitleArabic { get; set; }
    public string? Color { get; set; }
    public string? BackColor { get; set; }
    public string? Action { get; set; }
    public string? ExtraField { get; set; }
    public Guid? ChatResourceId { get; set; }

    public string ConcurrencyStamp { get; set; } = null!;

}    

And here is the API

 [Authorize(MyDhobiPermissions.ChatResources.Default)]
 public abstract class ChatResourcesAppServiceBase : ApplicationService
 {
     protected IDistributedCache<ChatResourceExcelDownloadTokenCacheItem, string> _excelDownloadTokenCache;
     protected IChatResourceRepository _chatResourceRepository;
     protected ChatResourceManager _chatResourceManager;

     public ChatResourcesAppServiceBase(IChatResourceRepository chatResourceRepository, ChatResourceManager chatResourceManager, IDistributedCache<ChatResourceExcelDownloadTokenCacheItem, string> excelDownloadTokenCache)
     {
         _excelDownloadTokenCache = excelDownloadTokenCache;
         _chatResourceRepository = chatResourceRepository;
         _chatResourceManager = chatResourceManager;
     }

     public virtual async Task<PagedResultDto<ChatResourceWithNavigationPropertiesDto>> GetListAsync(GetChatResourcesInput input)
     {
         var totalCount = await _chatResourceRepository.GetCountAsync(input.FilterText, input.ChipTitle, input.ChipTitleArabic, input.Color, input.BackColor, input.Action, input.ExtraField, input.ChatResourceId);
         var items = await _chatResourceRepository.GetListWithNavigationPropertiesAsync(input.FilterText, input.ChipTitle, input.ChipTitleArabic, input.Color, input.BackColor, input.Action, input.ExtraField, input.ChatResourceId, input.Sorting, input.MaxResultCount, input.SkipCount);

         return new PagedResultDto<ChatResourceWithNavigationPropertiesDto>
         {
             TotalCount = totalCount,
             Items = ObjectMapper.Map<List<ChatResourceWithNavigationProperties>, List<ChatResourceWithNavigationPropertiesDto>>(items)
         };
     }

     public virtual async Task<ChatResourceWithNavigationPropertiesDto> GetWithNavigationPropertiesAsync(Guid id)
     {
         return ObjectMapper.Map<ChatResourceWithNavigationProperties, ChatResourceWithNavigationPropertiesDto>
             (await _chatResourceRepository.GetWithNavigationPropertiesAsync(id));
     }

Since GetListAsync is returning 0 items but on creation data is getting saved properly in database , please help me resolve this issue ,what could be the cause and how can i resolve it ?


32 Answer(s)
  • User Avatar
    0
    surajlokhandemmew created

    does usermanager need ay permission?? and its this class right? IdentityUserManager

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    no the IdenttiyUserManager don’t need permission you are using the IdentityUserAppService and it required a permission. That’s why you get the exception

  • User Avatar
    0
    surajlokhandemmew created

    why this api (await _identityUserManager.AddPasswordAsync (userdetails,input.Password)).CheckErrors(); is asking for a password with non alphanumeric and upper case character when i have disabled it in settings.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Please try

    
    // inject IOptions<AbpIdentityOptions>
    protected IOptions<AbpIdentityOptions> AbpIdentityOptions { get; }
    
    .....
    
    await IdentityOptions.SetAsync(); // set option first.
    await _identityUserManager.AddPasswordAsync (userdetails,input.Password)).CheckErrors()
    
    
  • User Avatar
    0
    surajlokhandemmew created

    i am getting this error : using Microsoft.Extensions.Options;

    Options must be derived from the Volo.Abp.Options.AbpDynamicOptionsManager`1!",

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, my bad.

    Should be IOptions<IdentityOptions> not IOptions<AbpIdentityOptions>

  • User Avatar
    0
    surajlokhandemmew created

    Hi,

    Sorry, my bad.

    Should be IOptions<IdentityOptions> not IOptions<AbpIdentityOptions>

    working thanks a lot

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11