From f60ae6c24cae60ca22a65470bf51cb8f6b919d18 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Sat, 7 Oct 2023 13:49:03 +0200 Subject: [PATCH] add RDG010 example --- fundamentals/aot/diagnostics/Rdg10/Program.cs | 36 +++++++++++++++++++ .../aot/diagnostics/Rdg10/Rdg10.csproj | 11 ++++++ 2 files changed, 47 insertions(+) create mode 100644 fundamentals/aot/diagnostics/Rdg10/Program.cs create mode 100644 fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj diff --git a/fundamentals/aot/diagnostics/Rdg10/Program.cs b/fundamentals/aot/diagnostics/Rdg10/Program.cs new file mode 100644 index 0000000..443f806 --- /dev/null +++ b/fundamentals/aot/diagnostics/Rdg10/Program.cs @@ -0,0 +1,36 @@ +#define RDG10F // RDG10 RDG10F +#if NEVER +#elif RDG10 +// +using Microsoft.AspNetCore.Mvc; + +var builder = WebApplication.CreateBuilder(args); + +var app = builder.Build(); + +app.MapGet("/todos/{id}", ([AsParameters] TodoRequest? request) + => Results.Ok(new Todo(request!.Id))); + +app.Run(); + +public record TodoRequest(HttpContext HttpContext, [FromRoute] int Id); +public record Todo(int Id); +// +#elif RDG10F +// +using Microsoft.AspNetCore.Mvc; + +var builder = WebApplication.CreateBuilder(args); + +var app = builder.Build(); + +app.MapGet("/todos/{id}", ([AsParameters] TodoRequest request) + => Results.Ok(new Todo(request.Id))); + +app.Run(); + +public record TodoRequest(HttpContext HttpContext, [FromRoute] int Id); +public record Todo(int Id); +// +#endif + diff --git a/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj b/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj new file mode 100644 index 0000000..78554ea --- /dev/null +++ b/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj @@ -0,0 +1,11 @@ + + + + net8.0 + enable + enable + true + true + + +