// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddDbContext <AppDbContext>( o => o.UseSqlServer(Configuration.GetConnectionString("Conexao"), x => x.MigrationsAssembly("PUC.LDSI.DataBase"))); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); NativeBootStrapperBase.RegisterServices(services); AutoMapperConfig.RegisterMappings(); services.AddAuthorization(options => { options.AddPolicy("Professor", policy => policy.RequireRole("Professor")); options.AddPolicy("Aluno", policy => policy.RequireRole("Aluno")); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSwaggerDocumentation(); services.AddContextConfiguration(Configuration); services.AddCorsConfiguration(); NativeBootStrapperBase.RegisterServices(services); }