Пример #1
0
        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);
        }
Пример #2
0
        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);
        }