diff --git a/fundamentals/aot/diagnostics/Rdg10/Program.cs b/fundamentals/aot/diagnostics/Rdg10/Program.cs deleted file mode 100644 index 50072b7..0000000 --- a/fundamentals/aot/diagnostics/Rdg10/Program.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Text.Json.Serialization; - -var builder = WebApplication.CreateSlimBuilder(); -var todos = new[] -{ - new Todo(1, "Write tests"), - new Todo(2, "Fix tests") -}; - -builder.Services.AddSingleton(todos); - -builder.Services.ConfigureHttpJsonOptions(options => -{ - options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonSerializerContext.Default); -}); - -var app = builder.Build(); - - -app.MapGet("/v1/todos/{id?}", (int? Id, Todo[] todos) => -{ - if (Id.HasValue) - { - return todos.ToList().Find(todoItem => todoItem.Id == Id) - is Todo todo - ? Results.Ok(todo) - : Results.NotFound(); - } - else - { - return Results.Ok(todos); - } - -}); - -app.Run(); - - -public class Todo -{ - public DateTime DueDate { get; } - public int Id { get; private set; } - public string Task { get; private set; } - - // Additional constructors - public Todo(int Id, string Task, DateTime DueDate) - - { - this.Id = Id; - this.Task = Task; - this.DueDate = DueDate; - } - - public Todo(int Id, string Task) - : this(Id, Task, default) - { - } -} - -[JsonSerializable(typeof(Todo[]))] -internal partial class AppJsonSerializerContext : JsonSerializerContext -{ -} - diff --git a/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj b/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj deleted file mode 100644 index 8186e5b..0000000 --- a/fundamentals/aot/diagnostics/Rdg10/Rdg10.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - net8.0 - enable - enable - true - true - - -