From dc98ad67c6d7dabc7cf731fe50d581f089b8c543 Mon Sep 17 00:00:00 2001
From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
Date: Wed, 4 Oct 2023 19:44:54 +0200
Subject: [PATCH] add RDG012 example
---
fundamentals/aot/diagnostics/Rdg12/Program.cs | 59 +++++++++++++++++++
.../aot/diagnostics/Rdg12/Rdg12.csproj | 11 ++++
2 files changed, 70 insertions(+)
create mode 100644 fundamentals/aot/diagnostics/Rdg12/Program.cs
create mode 100644 fundamentals/aot/diagnostics/Rdg12/Rdg12.csproj
diff --git a/fundamentals/aot/diagnostics/Rdg12/Program.cs b/fundamentals/aot/diagnostics/Rdg12/Program.cs
new file mode 100644
index 0000000..de094fa
--- /dev/null
+++ b/fundamentals/aot/diagnostics/Rdg12/Program.cs
@@ -0,0 +1,59 @@
+#define RDG12F // RDG12 RDG12F
+#if NEVER
+#elif RDG12
+//
+var builder = WebApplication.CreateSlimBuilder(args);
+
+var app = builder.Build();
+app.MapEndpoints();
+app.Run();
+
+public static class TodoRouteBuilderExtensions
+{
+ public static IEndpointRouteBuilder MapEndpoints(this IEndpointRouteBuilder app)
+ {
+ app.MapPost("/input", (Todo value) => value);
+ app.MapGet("/result", () => new Todo());
+ app.MapPost("/input-with-wrapper", (Wrapper value) => value);
+ app.MapGet("/async", async () =>
+ {
+ await Task.CompletedTask;
+ return new Todo();
+ });
+ return app;
+ }
+
+ private record Todo { };
+}
+
+record Wrapper { }
+//
+#elif RDG12F
+//
+var builder = WebApplication.CreateSlimBuilder(args);
+
+var app = builder.Build();
+app.MapEndpoints();
+app.Run();
+
+public static class TodoRouteBuilderExtensions
+{
+ public static IEndpointRouteBuilder MapEndpoints(this IEndpointRouteBuilder app)
+ {
+ app.MapPost("/input", (Todo value) => value);
+ app.MapGet("/result", () => new Todo());
+ app.MapPost("/input-with-wrapper", (Wrapper value) => value);
+ app.MapGet("/async", async () =>
+ {
+ await Task.CompletedTask;
+ return new Todo();
+ });
+ return app;
+ }
+
+ public record Todo { };
+}
+
+record Wrapper { }
+//
+#endif
diff --git a/fundamentals/aot/diagnostics/Rdg12/Rdg12.csproj b/fundamentals/aot/diagnostics/Rdg12/Rdg12.csproj
new file mode 100644
index 0000000..c12d03b
--- /dev/null
+++ b/fundamentals/aot/diagnostics/Rdg12/Rdg12.csproj
@@ -0,0 +1,11 @@
+
+
+
+ net8.0
+ enable
+ enable
+ true
+ preview
+
+
+
\ No newline at end of file