Exemplo n.º 1
0
        private void SendSeekU()
        {
            // Use a custom configuration with our own ICommandBus implementation
            var host = new SeekUHostConfiguration <NsbStructureMapResolver>();

            // Configure commands to be published via NServiceBus instead of the
            // in-memory bus.
            host.ForCommandBus().Use <NServiceCommandBus>();
            // The NServiceCommandBus requires IBus as a constructor parameter.
            // This tells the resolver what to use for that dependency.
            host.For <IBus>().Use(Bus);

            var seekUBus = host.GetCommandBus();

            var id = Guid.NewGuid();

            Console.WriteLine("Sending create account command");
            seekUBus.Send(new CreateNewAccountCommand(id, 950));
            Console.WriteLine("Sending debit account command");
            seekUBus.Send(new DebitAccountCommand(id, 50));
            Console.WriteLine("Sending credit account command");
            seekUBus.Send(new CreditAccountCommand(id, 120));
            Console.WriteLine("Sending debit account command");
            seekUBus.Send(new DebitAccountCommand(id, 350));
        }
Exemplo n.º 2
0
        static void UseStructureMap()
        {
            Console.WriteLine("\r\n================\r\n");
            Console.WriteLine("Press a key to run with StructureMap");
            Console.ReadKey();
            // Configure using StructureMap
            var structureMapConfig = new SeekUHostConfiguration<StructureMapResolver>();
            structureMapConfig.ForSnapshotStore().Use<InMemorySnapshotStore>(store => ArbitraryConfigurationStep("StructureMap", store));
            structureMapConfig.For<IExample>().Use<Example>();

            IssueBankAccountCommands(structureMapConfig);
        }
Exemplo n.º 3
0
        static void UseNinject()
        {
            Console.WriteLine("Press a key to run with Ninject");
            Console.ReadKey();

            // Configure using Ninject
            var ninjectConfig = new SeekUHostConfiguration<NinjectResolver>();
            ninjectConfig.ForSnapshotStore().Use<InMemorySnapshotStore>(store => ArbitraryConfigurationStep("Ninject", store));
            ninjectConfig.For<IExample>().Use<Example>();

            IssueBankAccountCommands(ninjectConfig);
        }
Exemplo n.º 4
0
        static void UseWindsor()
        {
            Console.WriteLine("\r\n================\r\n");
            Console.WriteLine("Press a key to run with Castle Windsor");
            Console.ReadKey();

            // Configure using Windsor
            var ninjectConfig = new SeekUHostConfiguration<WindsorResolver>();
            ninjectConfig.ForSnapshotStore().Use<InMemorySnapshotStore>(store => ArbitraryConfigurationStep("Windsor", store));
            ninjectConfig.For<IExample>().Use<Example>();

            IssueBankAccountCommands(ninjectConfig);
        }
Exemplo n.º 5
0
        static void UseStructureMap()
        {
            Console.WriteLine("\r\n================\r\n");
            Console.WriteLine("Press a key to run with StructureMap");
            Console.ReadKey();
            // Configure using StructureMap
            var structureMapConfig = new SeekUHostConfiguration <StructureMapResolver>();

            structureMapConfig.ForSnapshotStore().Use <InMemorySnapshotStore>(store => ArbitraryConfigurationStep("StructureMap", store));
            structureMapConfig.For <IExample>().Use <Example>();

            IssueBankAccountCommands(structureMapConfig);
        }
Exemplo n.º 6
0
        static void UseNinject()
        {
            Console.WriteLine("Press a key to run with Ninject");
            Console.ReadKey();

            // Configure using Ninject
            var ninjectConfig = new SeekUHostConfiguration <NinjectResolver>();

            ninjectConfig.ForSnapshotStore().Use <InMemorySnapshotStore>(store => ArbitraryConfigurationStep("Ninject", store));
            ninjectConfig.For <IExample>().Use <Example>();

            IssueBankAccountCommands(ninjectConfig);
        }
Exemplo n.º 7
0
        static void UseWindsor()
        {
            Console.WriteLine("\r\n================\r\n");
            Console.WriteLine("Press a key to run with Castle Windsor");
            Console.ReadKey();

            // Configure using Windsor
            var ninjectConfig = new SeekUHostConfiguration <WindsorResolver>();

            ninjectConfig.ForSnapshotStore().Use <InMemorySnapshotStore>(store => ArbitraryConfigurationStep("Windsor", store));
            ninjectConfig.For <IExample>().Use <Example>();

            IssueBankAccountCommands(ninjectConfig);
        }
Exemplo n.º 8
0
        private void SendSeekU()
        {
            // Use a custom configuration with our own ICommandBus implementation
            var host = new SeekUHostConfiguration<NsbStructureMapResolver>();
            // Configure commands to be published via NServiceBus instead of the
            // in-memory bus.
            host.ForCommandBus().Use<NServiceCommandBus>();
            // The NServiceCommandBus requires IBus as a constructor parameter.
            // This tells the resolver what to use for that dependency.
            host.For<IBus>().Use(Bus);

            var seekUBus = host.GetCommandBus();

            var id = Guid.NewGuid();

            Console.WriteLine("Sending create account command");
            seekUBus.Send(new CreateNewAccountCommand(id, 950));
            Console.WriteLine("Sending debit account command");
            seekUBus.Send(new DebitAccountCommand(id, 50));
            Console.WriteLine("Sending credit account command");
            seekUBus.Send(new CreditAccountCommand(id, 120));
            Console.WriteLine("Sending debit account command");
            seekUBus.Send(new DebitAccountCommand(id, 350));
        }