// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <KorepetycjeContext>(options => options.UseSqlServer(this.Configuration.GetConnectionString("DefaultConnection"))); KorepetycjeContext.ConnectionString = this.Configuration.GetConnectionString("DefaultConnection"); SwaggerConfiguration.RegisterService(services); CorsConfiguration.Register(services, Configuration.GetSection(nameof(CorsConfigurationValues)).Get <CorsConfigurationValues>()); services.AddIdentity <User, IdentityRole <int> >() .AddEntityFrameworkStores <KorepetycjeContext>() .AddDefaultTokenProviders(); services.RegisterBearerPolicy(Configuration); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddAutoMapper(); // Register AutoMapper RegisterServices(services); RegisterRepositories(services); }