Created
May 25, 2020 09:26
-
-
Save ginomessmer/f143d649222f0f1f61d002e86c218746 to your computer and use it in GitHub Desktop.
Unidash Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Unidash.Auth.Domain.UserAggregate; | |
using MediatR; | |
namespace Unidash.Auth.Users.Queries | |
{ | |
public class FindUserQuery : IRequest<User> | |
{ | |
public string Id { get; set; } | |
public FindUserQuery(string id) | |
{ | |
Id = id; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Threading.Tasks; | |
using Unidash.Auth.Domain.UserAggregate; | |
using Unidash.Core.Infrastructure; | |
using MediatR; | |
namespace Unidash.Auth.Users.Queries | |
{ | |
public class FindUserQueryHandler : IRequestHandler<FindUserQuery, User> | |
{ | |
private readonly IEntityRepository<User> _repository; | |
public FindUserQueryHandler(IEntityRepository<User> repository) | |
{ | |
_repository = repository; | |
} | |
public async Task<User> Handle(FindUserQuery request, CancellationToken cancellationToken) | |
{ | |
return await _repository.FindByIdAsync(request.Id); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment