Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });
            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);

            ModuleInitializer.ConfigureServices(services, Configuration);

            services.AddDbContextPool <ApplicationDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("VisionDbConnection")));

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
Ejemplo n.º 2
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_2);

            services.AddAuthentication(options =>
            {
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(options =>
            {
                options.Authority            = Configuration["Jwt:Authority"];
                options.Audience             = Configuration["Jwt:Audience"];
                options.RequireHttpsMetadata = false;
            });

            ModuleInitializer.ConfigureServices(services, Configuration);

            services.AddHttpClient();
            services.AddHttpContextAccessor();
        }