Open Closed

IdentityUserRepository - GetQueryable #9406


User avatar
1
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
    2
    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.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on January 06, 2026, 13:47
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.