public async Task <string> Handle(HelloUserCommand command) { Mediador3.Mediador mediador = Mediador3.Mediador.CreateInstance(); await mediador.NotifyAllAsync(new HelloUserCommandWillRunNotification { UserName = command.UserName }); var result = await Task.FromResult($"Hello {command.UserName}!"); return(result); }
static async Task Main(string[] args) { Mediador3.Mediador mediador = Mediador3.Mediador.CreateInstance(); HelloUserCommand cmd = new HelloUserCommand() { UserName = "******" }; string result = await mediador.SendAsync <HelloUserCommand, string>(cmd); Console.WriteLine(result); HelloWordCommand cmd2 = new HelloWordCommand(); await mediador.SendASync <HelloWordCommand>(cmd2); }