chore: upgrade to .net10

This commit is contained in:
willem.serruys
2025-12-29 05:47:14 +01:00
parent 2dae2f232b
commit 23207c9b4b
2 changed files with 21 additions and 35 deletions

View File

@@ -1,41 +1,27 @@
var builder = WebApplication.CreateBuilder(args);
using Microsoft.AspNetCore.Mvc;
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.MapGet(
"/high_power_alert",
() =>
{
Console.WriteLine("high power alert was received.");
return new OkResult();
}
)
.WithName("HighPowerAlert");
app.UseHttpsRedirection();
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast");
app.MapGet(
"/low_power_alert",
() =>
{
Console.WriteLine("low power alert was received.");
return new OkResult();
}
)
.WithName("Low Power Alert");
app.Run();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}