// 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);
        }
Ejemplo n.º 2
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();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public static void RegisterComponents()
 {
     GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(InjectorConfig.GetContainer());
 }
Ejemplo n.º 5
0
 protected void Application_Start()
 {
     InjectorConfig.RegisterComponents();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Ejemplo n.º 6
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     InjectorConfig.Initialize();
 }