0
sateesh@g1.com.my created
- ABP Framework version: v4.2.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:"
How to get username from CreatorId for all records at a time ? Is there any sample code ?
3 Answer(s)
-
0
Hi,
if I understand correctly, are you looking for something like this?
private readonly IRepository<IdentityUser, Guid> _identityUserRepository; public async Task GetUserNamesByCreatorId() { var userNames= (await _identityUserRepository.GetListAsync(x => x.CreatorId == ...)).Select(x => x.UserName); }
-
-1
Hi,
if I understand correctly, are you looking for something like this?
private readonly IRepository<IdentityUser, Guid> _identityUserRepository; public async Task GetUserNamesByCreatorId() { var userNames= (await _identityUserRepository.GetListAsync(x => x.CreatorId == ...)).Select(x => x.UserName); }
Yes, but i need to get all records Creator name with single query execution
-
0
You need to custom a repository.
public class MyIdentityUserRepository : EfCoreRepository<IIdentityDbContext, IdentityUser, Guid>, IMyIdentityUserRepository { //..... public async Task GetCreatorNamesAsync(Guid creatorId) { var dbContext = await GetDbContextAsync(); var creatorNames = await (from creator in dbContext.Set<IdentityUser>() join user in dbContext.Set<IdentityUser>() on creator.Id equals user.CreatorId where user.CreatorId == creatorId select creator.Name).ToListAsync(); } }