Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var installers = typeof(Startup).Assembly.ExportedTypes.Where(x =>
                                                                          typeof(IInstaller).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract).Select(Activator.CreateInstance).Cast <IInstaller>().ToList();

            installers.ForEach(Installers => Installers.InstallerServices(services, Configuration));
            services.AddMvc(options =>
            {
                options.EnableEndpointRouting = false;
            })
            .AddFluentValidation(mvcConfiguration => mvcConfiguration.RegisterValidatorsFromAssemblyContaining <Startup>());
            services.AddAutoMapper(typeof(Startup));
        }