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)
        {
            services.AddControllersWithViews();

            services.AddDistributedMemoryCache();

            services.AddSession(options =>
            {
                options.IdleTimeout        = TimeSpan.FromMinutes(10);
                options.Cookie.HttpOnly    = true;
                options.Cookie.IsEssential = true;
            });

            //Recompiles when changing razor pages
            if (_env.IsDevelopment())
            {
                services.AddRazorPages()
                .AddRazorRuntimeCompilation();
            }


            //Di injection helper
            DiHelper.RegisterContainers(services);
        }