// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { services.AddDbContext <DatabaseContext>(options => options.UseSqlServer(_configuration.GetConnectionString("CadastroContext"))); InjectorConfig.RegisterServices(services, _configuration); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddMediatR(AppDomain.CurrentDomain.Load("CadastroProdutos.Application")); services.AddAutoMapper(AppDomain.CurrentDomain.Load("CadastroProdutos.Application")); services.AddScoped <UnitOfWorkActionFilter>(); services.AddControllers(); services.AddCors(options => { options.AddPolicy(_corsPolicy, builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); services.AddCustomMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_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_1); InjectorConfig.RegisterServices(services); var assemblyName = Assembly.GetExecutingAssembly().GetName().Name; var info = new Info { Version = SwaggerVersionName, Title = "API teste Inventti", Description = "API para testar strings primas", }; SwaggerConfig.AddSwagger(services, assemblyName, info); }