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