Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2017 01:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
internal class Program
private static void Main(string[] args)
var registry = new SubscriberRegistry();
registry.Register<GreetingCommand, GreetingCommandHandler>();
var tinyIoCContainer = new TinyIoCContainer();
tinyIoCContainer.Register<IHandleRequests<GreetingCommand>, GreetingCommandHandler>();
var commandStore =
new MySqlCommandStore(
new MySqlCommandStoreConfiguration("Server=localhost;Uid=root;Pwd=root;Database=BrighterTests",
var builder = CommandProcessorBuilder.With()
.Handlers(new HandlerConfiguration(
subscriberRegistry: registry,
handlerFactory: new TinyIocHandlerFactory(tinyIoCContainer)
.RequestContextFactory(new InMemoryRequestContextFactory());
var commandProcessor = builder.Build();
var greetingCommand = new GreetingCommand("Derek");
var retrievedCommand = commandStore.Get<GreetingCommand>(greetingCommand.Id);
Console.WriteLine(string.Format("Command retrieved from store: {0}", JsonConvert.SerializeObject(retrievedCommand)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment