Class MsSqlMessageStoreConfiguration.
Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var logger = LogProvider.For<Program>();

            var dbPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Substring(8)), "App_Data\\CommandStore.sdf");
            var connectionString = "DataSource=\"" + dbPath + "\"";
            var configuration = new MsSqlCommandStoreConfiguration(connectionString, "Commands", MsSqlCommandStoreConfiguration.DatabaseType.SqlCe);
            var commandStore = new MsSqlCommandStore(configuration, logger);

            var registry = new SubscriberRegistry();
            registry.Register<GreetingCommand, GreetingCommandHandler>();

            var tinyIoCContainer = new TinyIoCContainer();
            tinyIoCContainer.Register<IHandleRequests<GreetingCommand>, GreetingCommandHandler>();
            tinyIoCContainer.Register<IAmACommandStore>(commandStore);
            tinyIoCContainer.Register<ILog>(logger);

            var builder = CommandProcessorBuilder.With()
                .Handlers(new HandlerConfiguration(
                     subscriberRegistry: registry,
                     handlerFactory: new TinyIocHandlerFactory(tinyIoCContainer)
                    ))
                .DefaultPolicy()
                .Logger(logger)
                .NoTaskQueues()
                .RequestContextFactory(new InMemoryRequestContextFactory());

            var commandProcessor = builder.Build();

            var greetingCommand = new GreetingCommand("Ian");

            commandProcessor.Send(greetingCommand);

            var retrievedCommand = commandStore.Get<GreetingCommand>(greetingCommand.Id);

            var commandAsJson = JsonConvert.SerializeObject(retrievedCommand);

            Console.WriteLine(string.Format("Command retrieved from store: {0}", commandAsJson));

            Console.ReadLine();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="log">The log.</param>
 public MsSqlCommandStore(MsSqlCommandStoreConfiguration configuration, ILog log)
 {
     _configuration = configuration;
     _log           = log;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public MsSqlCommandStore(MsSqlCommandStoreConfiguration configuration)
     : this(configuration, LogProvider.GetCurrentClassLogger())
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MsSqlCommandStore" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="log">The log.</param>
 public MsSqlCommandStore(MsSqlCommandStoreConfiguration configuration, ILog log)
 {
     _configuration            = configuration;
     _log                      = log;
     ContinueOnCapturedContext = false;
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MsSqlCommandStore" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public MsSqlCommandStore(MsSqlCommandStoreConfiguration configuration)
 {
     _configuration            = configuration;
     ContinueOnCapturedContext = false;
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="MsSqlCommandStore" /> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public MsSqlCommandStore(MsSqlCommandStoreConfiguration configuration)
     : this(configuration, LogProvider.For <MsSqlCommandStore>())
 {
 }