Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();

            services.AddScoped <IRepository>(serviceProvider => EFRepositoryFactory.GetInstance(Configuration["DbConnStr"]));
        }
Esempio 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.AddMemoryCache();
            services.AddSession();

            // Add framework services.
            services.AddMvc();

            services.AddScoped <IRepository>(serviceProvider => EFRepositoryFactory.GetInstance(Configuration["DbConnStr"]));

            services.AddAuthorization(options => {
                options.AddPolicy("AdminOnly", policy =>
                                  policy.RequireClaim("IsAdmin"));
            });
        }