예제 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.UseSwaggerMiddleware(GetApiVersion(), "CLIENTES", "Api para cadastro e controle dos clientes.");

            services.AddCors(options =>
            {
                options.AddPolicy("CorsPolicy",
                                  builder => builder
                                  .SetIsOriginAllowed((host) => true)
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  .AllowCredentials()
                                  );
            });

            services
            .AddMvc(opts =>
            {
                opts.Conventions.Add(new CommaSeparatedRouteConvention());
                opts.EnableEndpointRouting = false;
            })
            .SetCompatibilityVersion(CompatibilityVersion.Latest)
            .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNameCaseInsensitive = true);

            var connectionString = Configuration.GetConnectionString("DefaultConnection");
            var domainName       = "Cliente";

            base.BaseConfiguration(services, connectionString, domainName);
            InjectorContainer.Register(services, connectionString, domainName);
        }
 protected void Application_Start()
 {
     DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(InjectorContainer.Register()));
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
예제 #3
0
        public virtual void ConfigureServices(IServiceCollection services)
        {
            services
            .AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Latest);

            services.AddMediatR(typeof(BaseStartup));

            InjectorContainer.Register(services);
        }