File tree Expand file tree Collapse file tree 5 files changed +55
-30
lines changed
frameworks/CSharp/genhttp Expand file tree Collapse file tree 5 files changed +55
-30
lines changed Original file line number Diff line number Diff line change 16
16
</PropertyGroup >
17
17
18
18
<ItemGroup >
19
- <None Remove =" Resources\Fortunes.html" />
20
- <None Remove =" Resources\Template.html" />
19
+ <None Remove =" Resources\Fortunes.html" />
20
+ <None Remove =" Resources\Template.html" />
21
21
</ItemGroup >
22
22
23
23
<ItemGroup >
24
- <EmbeddedResource Include =" Resources\Template.html" />
24
+ <EmbeddedResource Include =" Resources\Template.html" />
25
25
</ItemGroup >
26
26
27
27
<ItemGroup >
28
28
29
- <PackageReference Include =" GenHTTP.Core.Kestrel" Version =" 9.0.0" />
30
- <PackageReference Include =" GenHTTP.Modules.Razor" Version =" 8.6.0" />
31
- <PackageReference Include =" GenHTTP.Modules.Webservices" Version =" 9.0.0" />
29
+ <PackageReference Include =" GenHTTP.Core" Version =" 9.6.2" />
30
+ <PackageReference Include =" GenHTTP.Modules.Webservices" Version =" 9.6.2" />
32
31
33
- <PackageReference Include =" Microsoft.EntityFrameworkCore" Version =" 9.0.0 " />
34
- <PackageReference Include =" Npgsql.EntityFrameworkCore.PostgreSQL" Version =" 9.0.0 " />
32
+ <PackageReference Include =" Microsoft.EntityFrameworkCore" Version =" 9.0.1 " />
33
+ <PackageReference Include =" Npgsql.EntityFrameworkCore.PostgreSQL" Version =" 9.0.3 " />
35
34
36
35
</ItemGroup >
37
36
Original file line number Diff line number Diff line change 1
1
using Benchmarks . Tests ;
2
2
using Benchmarks . Utilities ;
3
- using GenHTTP . Engine . Kestrel ;
3
+
4
+ using GenHTTP . Engine . Internal ;
5
+
4
6
using GenHTTP . Modules . IO ;
5
7
using GenHTTP . Modules . Layouting ;
6
8
using GenHTTP . Modules . Webservices ;
7
9
8
10
var tests = Layout . Create ( )
9
11
. Add ( "plaintext" , Content . From ( Resource . FromString ( "Hello, World!" ) ) )
12
+ . Add ( "json" , new JsonHandler ( ) )
10
13
. Add ( "fortunes" , new FortuneHandler ( ) )
11
- . AddService < JsonResource > ( "json" )
12
14
. AddService < DbResource > ( "db" )
13
15
. AddService < QueryResource > ( "queries" )
14
16
. AddService < UpdateResource > ( "updates" )
Original file line number Diff line number Diff line change
1
+ using System . Text . Json ;
2
+
3
+ using GenHTTP . Api . Content ;
4
+ using GenHTTP . Api . Protocol ;
5
+
6
+ using GenHTTP . Modules . Conversion . Serializers . Json ;
7
+
8
+ namespace Benchmarks . Tests ;
9
+
10
+ public sealed class JsonResult
11
+ {
12
+
13
+ public string Message { get ; set ; }
14
+ }
15
+
16
+ public sealed class JsonHandler : IHandler
17
+ {
18
+ private static readonly FlexibleContentType _ContentType = new ( ContentType . ApplicationJson , "utf-8" ) ;
19
+
20
+ private static readonly JsonSerializerOptions _Options = new ( ) ;
21
+
22
+ public ValueTask PrepareAsync ( ) => new ( ) ;
23
+
24
+ public ValueTask < IResponse > HandleAsync ( IRequest request )
25
+ {
26
+ var result = new JsonResult ( )
27
+ {
28
+ Message = "Hello, World!"
29
+ } ;
30
+
31
+ var response = request . Respond ( )
32
+ . Content ( new JsonContent ( result , _Options ) )
33
+ . Type ( _ContentType )
34
+ . Build ( ) ;
35
+
36
+ return new ( response ) ;
37
+ }
38
+
39
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-cont
11
11
12
12
# final stage/image
13
13
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
14
+
15
+ ENV DOTNET_GCDynamicAdaptationMode=0
16
+ ENV DOTNET_ReadyToRun=0
17
+ ENV DOTNET_HillClimbing_Disable=1
18
+
14
19
WORKDIR /app
15
20
COPY --from=build /app .
16
21
You can’t perform that action at this time.
0 commit comments