chore: upgrade to .net10
This commit is contained in:
@@ -1,41 +1,27 @@
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
// Add services to the container.
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
|
|
||||||
builder.Services.AddOpenApi();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
app.MapGet(
|
||||||
if (app.Environment.IsDevelopment())
|
"/high_power_alert",
|
||||||
{
|
() =>
|
||||||
app.MapOpenApi();
|
{
|
||||||
}
|
Console.WriteLine("high power alert was received.");
|
||||||
|
return new OkResult();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.WithName("HighPowerAlert");
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.MapGet(
|
||||||
|
"/low_power_alert",
|
||||||
var summaries = new[]
|
() =>
|
||||||
{
|
{
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
Console.WriteLine("low power alert was received.");
|
||||||
};
|
return new OkResult();
|
||||||
|
}
|
||||||
app.MapGet("/weatherforecast", () =>
|
)
|
||||||
{
|
.WithName("Low Power Alert");
|
||||||
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.Run();
|
app.Run();
|
||||||
|
|
||||||
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
|
|
||||||
{
|
|
||||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user