Example #1
0
 private static void RegisterServices(IServiceCollection services, IConfiguration configuration)
 {
     NativeInjectorBootStrapper.Register(services, configuration);
 }
Example #2
0
 /// <summary>
 /// Registers the services.
 /// </summary>
 /// <param name="services">The services.</param>
 private static void RegisterServices(IServiceCollection services)
 {
     NativeInjectorBootStrapper.Register(services);
 }
Example #3
0
        /// <summary>
        /// Registers the services.
        /// </summary>
        /// <param name="services">The services.</param>
        private static void RegisterServices(IServiceCollection services)
        {
            NativeInjectorBootStrapper.Register(services);

            services.AddScoped(typeof(IPipelineBehavior <,>), typeof(LoggingBehavior <,>));
        }
Example #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(opt => { opt.EnableEndpointRouting = false; })
            .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

            services.AddApiVersioning(options =>
            {
                options.AssumeDefaultVersionWhenUnspecified = true;
                options.DefaultApiVersion = new ApiVersion(1, 0);
                options.ReportApiVersions = true;
            });

            services.AddVersionedApiExplorer(options =>
            {
                options.GroupNameFormat           = "'v'VVV";
                options.SubstituteApiVersionInUrl = true;
            });

            services.AddAutoMapper(typeof(Startup));

            NativeInjectorBootStrapper.Register(services);

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();


            services.AddSingleton(AutoMapperConfiguration.RegisterMappings().CreateMapper());
            services.AddScoped <IMapper>(sp => new Mapper(sp.GetRequiredService <AutoMapper.IConfigurationProvider>(), sp.GetService));


            services.AddDbContext <CompanyCreditCardContext>(options =>
            {
                options.UseSqlServer(Configuration.GetConnectionString("CompanyDB"));
            });

            // services.AddJwt(Configuration);

            services.AddSwaggerConfig(new OpenApiInfo
            {
                Version     = "v1",
                Title       = "Rafael API",
                Description = "API para teste",
                Contact     = new OpenApiContact
                {
                    Name  = "RafaelCompany",
                    Email = "*****@*****.**"
                }
            });

            services.AddMediatR(typeof(Startup));

            services.AddDIConfiguration();

            services.Configure <ApiBehaviorOptions>(options =>
            {
                options.SuppressModelStateInvalidFilter = true;
            });

            services.Configure <IISServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

            services.AddMemoryCache();

            services.AddControllers();
        }