using $REPO_NAME; using $REPO_NAME.Components; using $REPO_NAME.Models; var conf = greyn.Deployment.Configurator<$REPO_NAME.Configuration>.Load(); Shared.DBConnectionString = conf.DBConnectionString; Console.WriteLine(Shared.DBConnectionString); var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.Services.AddAuthorization(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseSwagger(); app.UseSwaggerUI(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAntiforgery(); app.MapGet("/hi", () => { var db = new $REPO_NAME_DBContext(); var greetcount = db.Greets.FirstOrDefault(); if(greetcount == null) { greetcount = new GreetCounter(); db.Greets.Add(greetcount); } greetcount.Amount++; db.SaveChanges(); return $"hello number {greetcount.Amount}"; }).WithName("hi").WithOpenApi(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.Run();