/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit.Abstractions/Middleware/CommandExtensions.cs
41 строка
1000 B
Chris Patterson
Integration of all external packages into MassTransit, split out into Abstractions, Middleware, and the core MassTransit assembly.
22 янв 2022, 18:24
22 янв 2022, 18:24
b5b4f50
Код
Авторство
О чём код?
namespace MassTransit { using System; using System.Threading.Tasks; using Contracts; using Middleware; public static class CommandExtensions { public static Task SendCommand<T>(this IPipe<CommandContext> pipe, T command) where T : class { if (pipe == null) throw new ArgumentNullException(nameof(pipe)); if (command == null) throw new ArgumentNullException(nameof(command)); var context = new SendCommandContext<T>(command); return pipe.Send(context); } class SendCommandContext<T> : BasePipeContext, CommandContext<T> where T : class { public SendCommandContext(T command) { Command = command; Timestamp = DateTime.UtcNow; } public DateTime Timestamp { get; } public T Command { get; } } } }