// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); //Setup para configuração do Swagger SwaggerConfiguration.AddSwagger(services); //Setup para configuração do EntityFramework EntityFrameworkConfiguration.AddEntityFramework(services, Configuration); //Setup para configuração do JWT JwtConfiguration.ConfigureServices(services, Configuration); //Setup para o MongoDB MongoDBConfiguration.AddMongoDBSetup(services, Configuration); //Injeção de dependência DependencyInjectionConfiguration.AddDependencyInjection(services); //Setup para o MediatR MediatRConfiguration.AddMediatRSetup(services); //Setup para o AutoMapper AutoMapperConfiguration.AddAutoMapperSetup(services); //Setup para o CORS CorsConfiguration.AddCors(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); SwaggerConfiguration.AddSwagger(services); EntityFrameworkConfiguration.AddEntityFramework(services); JwtConfiguration.AddJwt(services, Configuration); DependencyInjectionConfiguration.AddDependencyInjection(services); AutoMapperConfiguration.AddAutoMapperSetup(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <SecurityContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); // Registrar todos os DI DependencyInjectionConfiguration.AddDIConfiguration(services); // Configurações de Autenticação, Autorização e JWT. services.AddSecurity(Configuration); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "API Security", Version = "v1" }); }); // AutoMapper AutoMapperConfiguration.AddAutoMapperSetup(services); }