Replies: 1 comment 5 replies
-
You can modify the ICurrentUserService and add an Email property just like the UserId and then thru DI you can inject that interface to your CommandHandler and get the user email so you will no longer have to define Email property in your Command |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How should I pass user from controller to command? Is there any approach you can recommend?
Im using this approach;
Controller;
string? email = User.FindFirst(ClaimTypes.Email)?.Value;
command.Email = email;
var response = await Mediator.Send(command);
Command;
public class Command : IRequest
{
[JsonIgnore]
public string? Email { get; set; }
}
Beta Was this translation helpful? Give feedback.
All reactions