예제 #1
0
파일: Startup.cs 프로젝트: jolyeons/ODOT
        // 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"]));
        }
예제 #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"));
            });
        }