Esempio n. 1
0
        /// <summary>
        /// Process a command.
        /// </summary>
        /// <typeparam name="TCommand">Type of the command.</typeparam>
        /// <param name="command">Command to process.</param>
        public void Process <TCommand> (TCommand command) where TCommand : ICommand
        {
            //Here goes various validation logic.
            ICommandHandler <TCommand> commandHandler = HandlersDictionary.GetHandlerForCommandType(command);

            if (commandHandler != null)
            {
                commandHandler.Handle(command);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// This method gets called by the runtime. Use this method to add services to the container.
 /// </summary>
 /// <param name="services">Collection of services.</param>
 /// <returns>The service provider.</returns>
 public IServiceProvider ConfigureServices(IServiceCollection services)
 {
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
     services.AddSwaggerGen(options =>
     {
         options.SwaggerDoc("v1", new Info {
             Title = "Basket Api API", Version = "v1"
         });
         options.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + @"TestWorkTask.Web.xml");
     });
     ConfigureIoC(services);
     HandlersDictionary.PopulateHandlersDictionary();
     return(SystemObjectFactory.Container.GetInstance <IServiceProvider>());
 }