public ICommandRegistry <T> Execute <TCommand>( Action <TCommand, T> handler, Func <string, Task <LoadResult <T> > > load, Func <string, IReadOnlyList <Event>, IReadOnlyList <StreamVersion>, Task <IReadOnlyList <StreamVersion> > > save) where TCommand : ICommand { _registry.Execute(handler, load, save); return(this); }
/// <summary> /// Executes the specified command. /// </summary> /// <typeparam name="TBaseCommand">The base type that all commands inherit from, /// or a common interface for all. Can even be <see cref="object"/> if no /// common interface is needed.</typeparam> /// <param name="registry">The command registry to execute the command on.</param> /// <param name="commands">The commands to execute.</param> public static void Execute <TBaseCommand>(this ICommandRegistry <TBaseCommand> registry, IEnumerable <TBaseCommand> commands) { Guard.NotNull(() => registry, registry); Guard.NotNull(() => commands, commands); foreach (var command in commands) { registry.Execute(command, new Dictionary <string, object>()); } }
/// <summary> /// Executes the specified command with empty headers. /// </summary> /// <typeparam name="TBaseCommand">The base type that all commands inherit from, /// or a common interface for all. Can even be <see cref="object"/> if no /// common interface is needed.</typeparam> /// <param name="registry">The command registry to execute the command on.</param> /// <param name="command">The command to execute.</param> public static void Execute <TBaseCommand>(this ICommandRegistry <TBaseCommand> registry, TBaseCommand command) { Guard.NotNull(() => registry, registry); registry.Execute(command, new Dictionary <string, object>()); }
public ICommandRegistryWithDefaults <T> Execute <TCommand>(Action <TCommand, T> handler) where TCommand : ICommand { _registry.Execute(handler, _loadExisting, _saveExisting); return(this); }