From 36afbd7837c130be8d6eecadaa7b6f3b5db2b25c Mon Sep 17 00:00:00 2001 From: jojo aquino Date: Mon, 16 Dec 2024 01:01:28 +0000 Subject: [PATCH] add RuntimeCompilation --- .../EnotaryoPH.Web/EnotaryoPH.Web.csproj | 21 ++++++++++++------- EnotaryoPH/EnotaryoPH.Web/Program.cs | 6 +++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/EnotaryoPH/EnotaryoPH.Web/EnotaryoPH.Web.csproj b/EnotaryoPH/EnotaryoPH.Web/EnotaryoPH.Web.csproj index 715c85b..7586d47 100644 --- a/EnotaryoPH/EnotaryoPH.Web/EnotaryoPH.Web.csproj +++ b/EnotaryoPH/EnotaryoPH.Web/EnotaryoPH.Web.csproj @@ -1,13 +1,18 @@ - - net9.0 - enable - enable - + + net9.0 + enable + enable + + + + + + + + + - - - diff --git a/EnotaryoPH/EnotaryoPH.Web/Program.cs b/EnotaryoPH/EnotaryoPH.Web/Program.cs index a678b87..7bb5521 100644 --- a/EnotaryoPH/EnotaryoPH.Web/Program.cs +++ b/EnotaryoPH/EnotaryoPH.Web/Program.cs @@ -16,7 +16,11 @@ namespace EnotaryoPH.Web .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Login")); builder.Services.AddAuthorization(options => options.AddPolicy("PrincipalPolicy", policy => policy.RequireRole("Principal"))); - builder.Services.AddRazorPages(options => options.Conventions.AuthorizeFolder("/Principal", "PrincipalPolicy")); + var razorBuilder = builder.Services.AddRazorPages(options => options.Conventions.AuthorizeFolder("/Principal", "PrincipalPolicy")); +#if DEBUG + razorBuilder.AddRazorRuntimeCompilation(); +#endif + builder.Services.AddDbContext(); builder.Services.AddHttpContextAccessor(); builder.Services.AddSession(options => options.IdleTimeout = TimeSpan.FromMinutes(120));