Simple and handy command pattern implementation.
It allows implementing any logic behind the ICommandHandler<,,> and ICommand<,,> to work with any bot source
- Download the source code using github tools
- Open in your favorite IDE or code editor
- Run dotnet build and dotnet run ProgrammableMessagingService.dll
-
Determine the T message and TResponse types you're gonna use
-
Implement ICommandConstructorArgs - it'll be used a constructor arg for all the commands
-
Implement ICommandExecutionResult<TSource, TResponse, TStatus> - all command execution will have this result
-
Create a bunch of commands implementing CommandBase<TSource, TResponse, TStatus>. Polymorphism of commands heavily relies on constructor args. All required args for all the commands should be added into ICommandConstructorArgs
-
Implement the logic of any command overriding CommandBase<TSource, TResponse, TStatus>.Execute() and CommandBase<TSource, TResponse, TStatus>.ExecuteAsync()
-
Implement ICommandHandler<T, TResponse, TStatus> and its methods.
-
Done. You're brilliant!