Processor for handling generic commands
Clash Royale CLAN TAG #URR8PPP .everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0; up vote 2 down vote favorite I'm trying to implement business logic layer based on concepts of commands and command handlers. A command is a thing that contains input parameters for executing some action, and it knows what kind of output that action should produce. A command handler contains logic for actually executing an action: it accepts a command as a param, handles it in some way, and (if successful) produces an output object. public interface ICommand<TResultData> public interface ICommandHandler<TCommand, TResultData> where TCommand : ICommand<TResultData> CommandResult<TResultData> Handle(TCommand command); public static class CommandProcessor public static CommandResult<TResultData> Process<TCommand, TResultData>(TCommand command) where TCommand : ICommand<TResultData> var handler = Servi