File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
sample/SampleLambda-dotnet8 Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
using Amazon . Lambda . Core ;
2
2
using HeadlessChromium . Puppeteer . Lambda . Dotnet ;
3
3
using Microsoft . Extensions . Logging ;
4
+ using System . Text . Json . Serialization ;
4
5
5
6
namespace SampleLambda
6
7
{
@@ -22,4 +23,17 @@ public async Task<byte[]> Handle(ILambdaContext context)
22
23
return await File . ReadAllBytesAsync ( "./google.png" ) ;
23
24
}
24
25
}
26
+
27
+ /// <summary>
28
+ /// This class is used to register the input event and return type for the FunctionHandler method with the System.Text.Json source generator.
29
+ /// There must be a JsonSerializable attribute for each type used as the input and return type or a runtime error will occur
30
+ /// from the JSON serializer unable to find the serialization information for unknown types.
31
+ /// </summary>
32
+ [ JsonSerializable ( typeof ( string ) ) ]
33
+ public partial class LambdaFunctionJsonSerializerContext : JsonSerializerContext
34
+ {
35
+ // By using this partial class derived from JsonSerializerContext, we can generate reflection free JSON Serializer code at compile time
36
+ // which can deserialize our class and properties. However, we must attribute this class to tell it what types to generate serialization code for.
37
+ // See https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-source-generation
38
+ }
25
39
}
Original file line number Diff line number Diff line change 6
6
"function-timeout" : 60 ,
7
7
"function-handler" : " SampleLambda::SampleLambda.HelloWorldHandler::Handle" ,
8
8
"package-type" : " image" ,
9
- "docker-host-build-output-dir" : " ./bin/Release/lambda-publish"
10
- }
9
+ "docker-host-build-output-dir" : " ./bin/Release/lambda-publish" ,
10
+ "msbuild-parameters" : " --self-contained true"
11
+ }
You can’t perform that action at this time.
0 commit comments