namespace Yes.Application.Admins.Users { public record GetProfileQuery() : IRequest; public record GetProfileQueryResponse( int Id, string Name, string Email, string NickName, string Url ); public class GetProfileQueryHandler(BlogDbContext db, IMapper mapper, IIdentityContext identityContext) : IRequestHandler { private readonly BlogDbContext _db = db; private readonly IMapper _mapper = mapper; private readonly IIdentityContext _identityContext = identityContext; public async Task Handle(GetProfileQuery request, CancellationToken cancellationToken) { var userId = _identityContext.Id; var user = await _db.Users.FindAsync(userId); var response = _mapper.Map(user); return response; } } internal class GetMyProfileMappingProfile : IRegister { public void Register(TypeAdapterConfig config) { config.ForType(); } } }