// 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); }
protected void Application_Start() { InjectorConfig.RegisterInjector(); GlobalConfiguration.Configure(WebApiConfig.Register); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); MapperConfig.RegisterMaps(); }
// 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); }
public static void RegisterComponents() { GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(InjectorConfig.GetContainer()); }
protected void Application_Start() { InjectorConfig.RegisterComponents(); GlobalConfiguration.Configure(WebApiConfig.Register); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); InjectorConfig.Initialize(); }