예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers(opt =>
            {
                var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
                opt.Filters.Add(new AuthorizeFilter(policy));
            })


            .AddFluentValidation(ConfigurationBinder =>
            {
                ConfigurationBinder.RegisterValidatorsFromAssemblyContaining <Create>();
            });
            services.AddApplicationServices(_config);
            services.AddIdentityServices(_config);
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddHttpClient();
            services.AddControllers(x => x.AllowEmptyInputInBodyModelBinding = true)
            .AddFluentValidation(ConfigurationBinder =>
            {
                ConfigurationBinder.RegisterValidatorsFromAssemblyContaining <Search>();
            });

            services.AddStackExchangeRedisCache(options =>
            {
                options.Configuration = "localhost:6379";
            });

            services.AddApplicationServices(_config);
            services.AddIdentityServices(_config);
        }