Exemple #1
0
        public static void Main()
        {
            if (File.Exists("Readme.md"))
            {
                Console.WriteLine(File.ReadAllText("Readme.md"));
            }

            // persistence
            var store  = CreateFileStoreForTesting();
            var events = new EventStore(store);

            // various domain services
            var pricing = new PricingService();

            var server = new ApplicationServer();

            server.Handlers.Add(new LoggingWrapper(new CustomerApplicationService(events, pricing)));

            // send some sample commands
            server.Dispatch(new CreateCustomer {
                Id = new CustomerId(12), Name = "Lokad", Currency = Currency.Eur
            });
            server.Dispatch(new RenameCustomer {
                Id = new CustomerId(12), NewName = "Lokad SAS"
            });
            server.Dispatch(new ChargeCustomer {
                Id = new CustomerId(12), Amount = 20m.Eur(), Name = "Forecasting"
            });

            Console.WriteLine("Press any key to exit");
            Console.ReadKey(true);
        }
        public static void Main()
        {
            if (File.Exists("Readme.md"))
                Console.WriteLine(File.ReadAllText("Readme.md"));

            // persistence
            var store = CreateFileStoreForTesting();
            var events = new EventStore(store);

            // various domain services
            var pricing = new PricingService();

            var server = new ApplicationServer();
            server.Handlers.Add(new LoggingWrapper(new CustomerApplicationService(events, pricing)));

            // send some sample commands
            server.Dispatch(new CreateCustomer {Id = new CustomerId(12), Name = "Lokad", Currency = Currency.Eur});
            server.Dispatch(new RenameCustomer {Id = new CustomerId(12), NewName = "Lokad SAS"});
            server.Dispatch(new ChargeCustomer {Id = new CustomerId(12), Amount = 20m.Eur(), Name = "Forecasting"});

            Console.WriteLine("Press any key to exit");
            Console.ReadKey(true);
        }