Aggiornamento a .net9 e aggiunto MudBlazor

This commit is contained in:
2025-05-07 14:36:13 +02:00
parent 04e52b67ec
commit 77bcca44eb
12 changed files with 72 additions and 84 deletions

View File

@@ -1,5 +1,8 @@
using IntegryApiClient.Blazor;
using Template.Web.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
using Template.Shared.Components;
using Template.Shared.Interfaces;
using Template.Web.Services;
@@ -10,34 +13,16 @@ const string BaseRestServicesEndpoint = "https://devservices.studioml.it/ems-api
const string BaseRestServicesEndpoint = "https://services.studioml.it/ems-api/";
#endif
var builder = WebApplication.CreateBuilder(args);
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddBlazorBootstrap();
builder.Services.AddMudServices();
builder.Services.AddAuthorizationCore();
builder.Services.UseIntegry(BaseRestServicesEndpoint);
builder.Services.AddScoped<IFormFactor, FormFactor>();
var app = builder.Build();
builder.RootComponents.Add<Routes>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// 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.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddAdditionalAssemblies(typeof(Template.Shared._Imports).Assembly);
app.Run();
await builder.Build().RunAsync();