Exemple #1
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddApplicationInsightsTelemetry();

            services.AddMvc(options => { options.Filters.Add <UnhandledExceptionFilter>(); });

            services.AddCors();

            if (Environment.IsEnvironment("UnitTest"))
            {
                return(ApplicationBootstrap.RegisterServicesForTesting(services));
            }

            return(ApplicationBootstrap.RegisterServices(services, Configuration));
        }
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddApplicationInsightsTelemetry();

            services.AddMvc(options =>
            {
                options.Filters.Add <UnhandledExceptionFilter>();
                options.Filters.Add <ModelValidationFilter>();
            })
            .AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <AddPassengerCommandValidator>());;

            services.AddCors();

            if (Environment.IsEnvironment("UnitTest"))
            {
                return(ApplicationBootstrap.RegisterServicesForTesting(services));
            }

            return(ApplicationBootstrap.RegisterServices(services, Configuration));
        }