File tree Expand file tree Collapse file tree 6 files changed +24
-18
lines changed
frameworks/CSharp/fastendpoints Expand file tree Collapse file tree 6 files changed +24
-18
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Web" >
22
33 <PropertyGroup >
4- <TargetFramework >net8 .0</TargetFramework >
4+ <TargetFramework >net9 .0</TargetFramework >
55 <Nullable >enable</Nullable >
66 <ImplicitUsings >enable</ImplicitUsings >
77 <NoWarn >CA2016;IDE1006</NoWarn >
Original file line number Diff line number Diff line change 11namespace Benchmarks . Endpoints ;
22
3- public sealed class JsonEndpoint : Endpoint < EmptyRequest , object >
3+ sealed class JsonEndpoint : Ep . NoReq . Res < object >
44{
55 public override void Configure ( )
66 {
77 Get ( "/json" ) ;
88 AllowAnonymous ( ) ;
99 }
1010
11- public override Task HandleAsync ( EmptyRequest _ , CancellationToken __ )
11+ public override Task HandleAsync ( CancellationToken ct )
1212 {
1313 HttpContext . Response . ContentLength = 27 ;
14+
1415 return SendAsync ( new { message = "Hello, World!" } ) ;
1516 }
1617}
Original file line number Diff line number Diff line change 11namespace Benchmarks . Endpoints ;
22
3- public sealed class PlainTextEndpoint : Endpoint < EmptyRequest , EmptyResponse >
3+ sealed class PlainTextEndpoint : Ep . NoReq . Res < byte [ ] >
44{
5- private static readonly byte [ ] payload = System . Text . Encoding . UTF8 . GetBytes ( "Hello, World!" ) ;
5+ static readonly byte [ ] _payload = "Hello, World!"u8 . ToArray ( ) ;
66
77 public override void Configure ( )
88 {
99 Get ( "/plaintext" ) ;
1010 AllowAnonymous ( ) ;
1111 }
1212
13- public override Task HandleAsync ( EmptyRequest _ , CancellationToken __ )
13+ public override Task HandleAsync ( CancellationToken ct )
1414 {
1515 HttpContext . Response . StatusCode = StatusCodes . Status200OK ;
1616 HttpContext . Response . ContentType = "text/plain" ;
17- HttpContext . Response . ContentLength = payload . Length ;
18- return HttpContext . Response . Body . WriteAsync ( payload , 0 , payload . Length ) ;
17+ HttpContext . Response . ContentLength = _payload . Length ;
18+
19+ return HttpContext . Response . Body . WriteAsync ( _payload , 0 , _payload . Length ) ;
1920 }
2021}
Original file line number Diff line number Diff line change 11global using FastEndpoints ;
22
3- var builder = WebApplication . CreateBuilder ( ) ;
4- builder . Logging . ClearProviders ( ) ;
5- builder . Services . AddFastEndpoints ( ) ;
3+ var bld = WebApplication . CreateBuilder ( ) ;
4+ bld . Logging . ClearProviders ( ) ;
5+ bld . Services . AddFastEndpoints ( ) ;
66
7- var app = builder . Build ( ) ;
7+ var app = bld . Build ( ) ;
88app . UseFastEndpoints ( ) ;
9- app . Run ( "http://0.0.0.0:8080" ) ;
9+ app . Run ( "http://0.0.0.0:8080" ) ;
Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ This includes tests for plaintext and json serialization.
55
66** Language**
77
8- * C# 12 .0
8+ * C# 13 .0
99
1010** Platforms**
1111
12- * .NET 8 (Windows and Linux)
12+ * .NET 9 (Windows and Linux)
1313
1414** Web Servers**
1515
@@ -18,7 +18,7 @@ This includes tests for plaintext and json serialization.
1818** Web Stack**
1919
2020* [ FastEndpoints] ( https://fast-endpoints.com/ )
21- * ASP.NET 8
21+ * ASP.NET 9
2222
2323## Paths & Source for Tests
2424
Original file line number Diff line number Diff line change 1- FROM mcr.microsoft.com/dotnet/sdk:8 .0 AS build
1+ FROM mcr.microsoft.com/dotnet/sdk:9 .0 AS build
22WORKDIR /app
33COPY Benchmarks .
44RUN dotnet publish -c Release -o out
55
6- FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
6+ FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
7+ ENV DOTNET_GCDynamicAdaptationMode=0
8+ ENV DOTNET_ReadyToRun=0
9+ ENV DOTNET_HillClimbing_Disable=1
10+
711WORKDIR /app
812COPY --from=build /app/out ./
913
You can’t perform that action at this time.
0 commit comments