Esempio n. 1
0
        /// <summary>
        /// Configures a <see cref="CommandResult"/> as the result
        /// </summary>
        /// <param name="mediator"></param>
        /// <param name="cmdId"></param>
        /// <param name="configResult"></param>
        public static void SetResult(this ICommandResultMediator mediator, Guid cmdId, Action <CommandResult> configResult)
        {
            configResult.MustNotBeNull();
            var result = new CommandResult();

            configResult(result);
            mediator.AddResult(cmdId, result);
        }
 public BusWithCommandResultMediator(IDomainBus bus,ICommandResultMediator med)
 {
     _bus = bus;
     _med = med;
 }
Esempio n. 3
0
 /// <summary>
 /// Creates an instance (that should be registered as singleton in a DI Container) of a mediator
 /// which waits for a command handler result, executed by the domain bus in the same process.
 /// The command handler will need to take <see cref="IReturnCommandResult"/> as a dependency to communicate the result
 /// in the form of <see cref="CommandResult"/>. If you don't need a result, better use <see cref="IDispatchMessages"/> instead.
 /// This feature is useless in distributed apps.
 /// </summary>
 /// <param name="bus"></param>
 /// <param name="mediator"></param>
 /// <returns></returns>
 public static IRequestCommandResult GetCommandResultMediator(this IDomainBus bus, ICommandResultMediator mediator)
 => new BusWithCommandResultMediator(bus, mediator);
Esempio n. 4
0
 /// <summary>
 /// Adds an empty <see cref="CommandResult"/>
 /// </summary>
 /// <param name="mediator"></param>
 /// <param name="cmdId"></param>
 public static void AddEmptyCommandResult(this ICommandResultMediator mediator, Guid cmdId)
 {
     mediator.AddResult(cmdId, new CommandResult());
 }