Forráskód Böngészése

[FastEndpoints] Upgrade to latest version and code improvements (#7179)

Dĵ ΝιΓΞΗΛψΚ 3 éve
szülő
commit
ca7928808b

+ 1 - 1
frameworks/CSharp/fastendpoints/Benchmarks/Benchmarks.csproj

@@ -8,7 +8,7 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="FastEndpoints" Version="3.1.*" />
+        <PackageReference Include="FastEndpoints" Version="3.*" />
     </ItemGroup>
 
 </Project>

+ 0 - 25
frameworks/CSharp/fastendpoints/Benchmarks/Benchmarks.sln

@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.32002.185
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks.csproj", "{95F15ACC-FFB8-4C45-BF4E-6E2B602C1EBA}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{95F15ACC-FFB8-4C45-BF4E-6E2B602C1EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{95F15ACC-FFB8-4C45-BF4E-6E2B602C1EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{95F15ACC-FFB8-4C45-BF4E-6E2B602C1EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{95F15ACC-FFB8-4C45-BF4E-6E2B602C1EBA}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {975848F3-00CE-49FC-A82F-86DDC0A3CC6F}
-	EndGlobalSection
-EndGlobal

+ 2 - 2
frameworks/CSharp/fastendpoints/Benchmarks/Endpoints/JsonEndpoint.cs

@@ -1,6 +1,6 @@
 namespace Benchmarks.Endpoints;
 
-public class JsonEndpoint : Endpoint<object, object>
+public class JsonEndpoint : Endpoint<EmptyRequest, object>
 {
     public override void Configure()
     {
@@ -8,7 +8,7 @@ public class JsonEndpoint : Endpoint<object, object>
         AllowAnonymous();
     }
 
-    public override Task HandleAsync(object _, CancellationToken __)
+    public override Task HandleAsync(EmptyRequest _, CancellationToken __)
     {
         HttpContext.Response.ContentLength = 27;
         return SendAsync(new { message = "Hello, World!" });

+ 2 - 2
frameworks/CSharp/fastendpoints/Benchmarks/Endpoints/PlainTextEndpoint.cs

@@ -1,6 +1,6 @@
 namespace Benchmarks.Endpoints;
 
-public class PlainTextEndpoint : Endpoint<object, object>
+public class PlainTextEndpoint : Endpoint<EmptyRequest, EmptyResponse>
 {
     private static readonly byte[] payload = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
 
@@ -10,7 +10,7 @@ public class PlainTextEndpoint : Endpoint<object, object>
         AllowAnonymous();
     }
 
-    public override Task HandleAsync(object _, CancellationToken __)
+    public override Task HandleAsync(EmptyRequest _, CancellationToken __)
     {
         HttpContext.Response.StatusCode = StatusCodes.Status200OK;
         HttpContext.Response.ContentType = "text/plain";

+ 1 - 1
frameworks/CSharp/fastendpoints/Benchmarks/Program.cs

@@ -6,4 +6,4 @@ builder.Services.AddFastEndpoints();
 
 var app = builder.Build();
 app.UseFastEndpoints();
-app.Run();
+app.Run("http://0.0.0.0:8080");

+ 0 - 8
frameworks/CSharp/fastendpoints/Benchmarks/appsettings.Development.json

@@ -1,8 +0,0 @@
-{
-  "Logging": {
-    "LogLevel": {
-      "Default": "Information",
-      "Microsoft.AspNetCore": "Warning"
-    }
-  }
-}

+ 0 - 15
frameworks/CSharp/fastendpoints/Benchmarks/appsettings.json

@@ -1,15 +0,0 @@
-{
-  "Logging": {
-    "LogLevel": {
-      "Default": "Warning"
-    }
-  },
-  "AllowedHosts": "*",
-  "Kestrel": {
-    "Endpoints": {
-      "Http": {
-        "Url": "http://*:8080"
-      }
-    }
-  }
-}

+ 6 - 2
frameworks/CSharp/fastendpoints/fastendpoints.dockerfile

@@ -1,12 +1,16 @@
-FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
 WORKDIR /app
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 
-FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
+FROM mcr.microsoft.com/dotnet/aspnet:6.0.0 AS runtime
 WORKDIR /app
 COPY --from=build /app/out ./
 
+ENV DOTNET_TieredPGO 1 
+ENV DOTNET_TC_QuickJitForLoops 1 
+ENV DOTNET_ReadyToRun 0
+
 EXPOSE 8080
 
 ENTRYPOINT ["dotnet", "Benchmarks.dll"]