Open Closed

IdentityUserRepository - GetQueryable #9406


User avatar
0
kkmy created

Hello,

I have a join query like this:

var result = await
(
    from car in await _carRepository.GetQueryableAsync()
    join iu in await _identityUserRepository.GetQueryableAsync() on car.CreatorId equals iu.Id
    where car.Code == "CAR-1"
    select new CarDto
    {
        Id = car.Id,
        Code = car.Code,
        CreatedAt = car.CreationTime,
        CreatedBy = iu.Name
    }
).FirstOrDefaultAsync();

However, this does not work since IdentityUserRepository does not have a GetQueryableAsync() method. What should be the approach here if I want to get the creator name in a join query?

Thanks.


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

    hi

    Is your code in the AppService layer?

  • User Avatar
    1
    enisn created
    Support Team .NET Developer

    Hi,

    IIdentityUserRepository implements IBasicRepository that does not have GetQueryableAsync() method on it.

    If you need, you can use IRepository<IdentityUser,Guid> by injecting it.

    It has GetQueryableAsync method that you can use:

    public class MyService
    {
        protected readonly IRepository<IdentityUser, Guid> _userRepository;
        public MyService(IRepository<IdentityUser, Guid> userRepository)
        {
            _userRepository = userRepository;
        }
    
        public async Task DoSomethingAsync()
        {
            var queryable = await _userRepository.GetQueryableAsync();
            // Do something with the users
        }
    }
    
  • User Avatar
    0
    kkmy created

    This works, thank you so much.

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 v9.3.0-preview. Updated on June 13, 2025, 11:37