Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });

            var configurator = new AppConfigurator(services);

            configurator.ConfigureDependencyInjection();
            configurator.EstablishDatabaseConnection(Configuration.GetConnectionString("DefaultConnection"));
            configurator.AddAutoMapper();

            var appSettingsSection    = Configuration.GetSection("AppSettings");
            var configurationEmailObj = Configuration.GetSection("EmailConfiguration").Get <EmailConfiguration>();

            configurator.AddEmailDependencyInjection(configurationEmailObj);
            services.Configure <AppSettings>(appSettingsSection);
            var appSettings = appSettingsSection.Get <AppSettings>();

            configurator.ConfigureJwtAuthentication(appSettings.Secret);
        }