// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            CommandsAndEventsRegisterEngine.Init();

            CommandsAndEventsRegisterEngine.AutoRegisterForHandlers();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            app.UseSwagger();

            app.UseSwaggerUi3(settings =>
            {
                settings.GeneratorSettings.DefaultPropertyNameHandling = PropertyNameHandling.CamelCase;
            });


            app.UseMvc();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            CommandsAndEventsRegisterEngine.Init();

            CommandsAndEventsRegisterEngine.AutoRegisterForHandlers();

            Console.WriteLine("Try to create sample data");
            Guid   sampleId = Guid.NewGuid();
            Random rnd      = new Random();

            while (true)
            {
                Console.WriteLine("--- Menu:Begin ---");
                Console.WriteLine("Type 'create' to create new");
                Console.WriteLine("Type 'update' to update with latest create Id with random version");
                Console.WriteLine("Type 'quit' to close console");
                Console.WriteLine("--- Menu:End ---");

                var cmd = Console.ReadLine();

                if (cmd == "quit")
                {
                    Environment.Exit(0);
                    return;
                }

                if (cmd == "create")
                {
                    sampleId = Guid.NewGuid();
                    CommandPublisher.Instance.Send(new CreateSample(sampleId, "Version.1.0", "{}"));
                }

                if (cmd == "update")
                {
                    var v = rnd.Next(1, 100);
                    CommandPublisher.Instance.Send(new ChangeVersionOfSample(sampleId, $"Version.{v}.0"));
                }
            }
        }