Browse Source

Update dotnet version (#9376)

Sébastien Ros 9 months ago
parent
commit
d91f0176a7

+ 1 - 1
frameworks/CSharp/aspnetcore/appsettings.postgresql.json

@@ -1,4 +1,4 @@
 {
-  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=18;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000",
+  "ConnectionString": "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=512;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4",
   "Database": "postgresql"
 }

+ 3 - 3
frameworks/CSharp/aspnetcore/aspnetcore-aot.dockerfile

@@ -1,12 +1,12 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
 RUN apt-get update
 RUN apt-get -yqq install clang zlib1g-dev
 WORKDIR /app
 COPY src/Platform .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql /p:PublishAot=true /p:OptimizationPreference=Speed /p:GarbageCollectionAdaptationMode=0
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
-ENV URLS http://+:8080
+FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
+ENV URLS=http://+:8080
 
 WORKDIR /app
 COPY --from=build /app/out ./

+ 5 - 2
frameworks/CSharp/aspnetcore/aspnetcore-minimal.dockerfile

@@ -1,10 +1,13 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
 WORKDIR /app
 COPY src/Minimal .
 RUN dotnet publish -c Release -o out
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
 ENV URLS http://+:8080
+ENV DOTNET_GCDynamicAdaptationMode=0
+ENV DOTNET_ReadyToRun=0
+ENV DOTNET_HillClimbing_Disable=1
 
 WORKDIR /app
 COPY --from=build /app/out ./

+ 5 - 2
frameworks/CSharp/aspnetcore/aspnetcore-mvc.dockerfile

@@ -1,10 +1,13 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
 WORKDIR /app
 COPY src/Mvc .
 RUN dotnet publish -c Release -o out
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
 ENV URLS http://+:8080
+ENV DOTNET_GCDynamicAdaptationMode=0
+ENV DOTNET_ReadyToRun=0
+ENV DOTNET_HillClimbing_Disable=1
 
 WORKDIR /app
 COPY --from=build /app/out ./

+ 5 - 2
frameworks/CSharp/aspnetcore/aspnetcore-mysql.dockerfile

@@ -1,10 +1,13 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
 WORKDIR /app
 COPY src/Platform .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=MySqlConnector
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
 ENV URLS http://+:8080
+ENV DOTNET_GCDynamicAdaptationMode=0
+ENV DOTNET_ReadyToRun=0
+ENV DOTNET_HillClimbing_Disable=1
 
 WORKDIR /app
 COPY --from=build /app/out ./

+ 6 - 3
frameworks/CSharp/aspnetcore/aspnetcore.dockerfile

@@ -1,10 +1,13 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
 WORKDIR /app
 COPY src/Platform .
 RUN dotnet publish -c Release -o out /p:DatabaseProvider=Npgsql
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
-ENV URLS http://+:8080
+FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
+ENV URLS=http://+:8080
+ENV DOTNET_GCDynamicAdaptationMode=0
+ENV DOTNET_ReadyToRun=0
+ENV DOTNET_HillClimbing_Disable=1
 
 WORKDIR /app
 COPY --from=build /app/out ./

+ 4 - 4
frameworks/CSharp/aspnetcore/src/Minimal/Minimal.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
+    <TargetFramework>net9.0</TargetFramework>
     <Nullable>enable</Nullable>
     <ImplicitUsings>enable</ImplicitUsings>
     <LangVersion>latest</LangVersion>
@@ -9,9 +9,9 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Npgsql" Version="8.0.3" />
-    <PackageReference Include="Dapper" Version="2.1.21" />
-    <PackageReference Include="RazorSlices" Version="0.7.0" />
+    <PackageReference Include="Npgsql" Version="8.0.5" />
+    <PackageReference Include="Dapper" Version="2.1.35" />
+    <PackageReference Include="RazorSlices" Version="0.8.1" />
   </ItemGroup>
 
 </Project>

+ 6 - 8
frameworks/CSharp/aspnetcore/src/Minimal/Program.cs

@@ -1,13 +1,11 @@
 // Copyright (c) .NET Foundation. All rights reserved. 
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 
 
-using System.Text.Encodings.Web;
-using System.Text.Unicode;
-using Microsoft.AspNetCore.Http.HttpResults;
-using RazorSlices;
 using Minimal;
 using Minimal.Database;
 using Minimal.Models;
+using System.Text.Encodings.Web;
+using System.Text.Unicode;
 
 var builder = WebApplication.CreateBuilder(args);
 
@@ -36,14 +34,14 @@ app.MapGet("/json", () => new { message = "Hello, World!" });
 
 app.MapGet("/db", async (Db db) => await db.LoadSingleQueryRow());
 
-var createFortunesTemplate = RazorSlice.ResolveSliceFactory<List<Fortune>>("/Templates/Fortunes.cshtml");
 var htmlEncoder = CreateHtmlEncoder();
 
 app.MapGet("/fortunes", async (HttpContext context, Db db) => {
     var fortunes = await db.LoadFortunesRows();
-    var template = (RazorSliceHttpResult<List<Fortune>>)createFortunesTemplate(fortunes);
-    template.HtmlEncoder = htmlEncoder;
-    return template;
+    var result = Results.Extensions.RazorSlice<Minimal.Slices.Fortunes, List<Fortune>>(fortunes);
+    result.HtmlEncoder = htmlEncoder;
+
+    return result;
 });
 
 app.MapGet("/queries/{count?}", async (Db db, string? count) => await db.LoadMultipleQueriesRows(count));

+ 0 - 0
frameworks/CSharp/aspnetcore/src/Minimal/Templates/Fortunes.cshtml → frameworks/CSharp/aspnetcore/src/Minimal/Slices/Fortunes.cshtml


+ 0 - 0
frameworks/CSharp/aspnetcore/src/Minimal/Templates/_ViewImports.cshtml → frameworks/CSharp/aspnetcore/src/Minimal/Slices/_ViewImports.cshtml


+ 3 - 3
frameworks/CSharp/aspnetcore/src/Mvc/Mvc.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
+    <TargetFramework>net9.0</TargetFramework>
     <Nullable>enable</Nullable>
     <ImplicitUsings>enable</ImplicitUsings>
     <LangVersion>latest</LangVersion>
@@ -9,8 +9,8 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="Npgsql" Version="8.0.3" />
-    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0-rc.2" />
+    <PackageReference Include="Npgsql" Version="8.0.5" />
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0-rc.2" />
   </ItemGroup>
 
 </Project>

+ 4 - 4
frameworks/CSharp/aspnetcore/src/Platform/Platform.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net8.0</TargetFramework>
+    <TargetFramework>net9.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <IsTestAssetProject>true</IsTestAssetProject>
     <LangVersion>preview</LangVersion>
@@ -19,9 +19,9 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Npgsql" Version="8.0.3" />
-    <PackageReference Include="MySqlConnector" Version="2.3.1" />
-    <PackageReference Include="Dapper" Version="2.1.21" />
+    <PackageReference Include="Npgsql" Version="8.0.5" />
+    <PackageReference Include="MySqlConnector" Version="2.3.7" />
+    <PackageReference Include="Dapper" Version="2.1.35" />
     <PackageReference Include="RazorSlices" Version="0.7.0" Condition="$(PublishAot) != 'true'" />
   </ItemGroup>
 

+ 0 - 1
frameworks/CSharp/aspnetcore/src/Platform/Program.cs

@@ -52,7 +52,6 @@ public class Program
 #if DEBUG
             .AddUserSecrets<Program>()
 #endif
-            .AddEnvironmentVariables()
             .AddEnvironmentVariables()
             .AddCommandLine(args)
             .Build();