コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            ServiceConfiguration.Configure(Configuration.GetConnectionString("IAFProjectDatabase"), services);

            #region JWT token configuration

            var appSettingsSection = Configuration.GetSection("AppSettings");
            services.Configure <AppSettings>(appSettingsSection);
            AppSettings appSettings = appSettingsSection.Get <AppSettings>();

            ServiceConfiguration.Authenticate(services, appSettings.Secret);

            #endregion

            ServiceConfiguration.ConfigureServices(services);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
            .AddJsonOptions(opt => opt.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver());
        }