Merge pull request #206 from dotnet/r9

remove double blank lines
pull/207/head
Rick Anderson 2023-10-03 14:36:14 -10:00 committed by GitHub
commit 0b1ce5ad3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 9 deletions

View File

@ -18,7 +18,6 @@ builder.Services.ConfigureHttpJsonOptions(options =>
var app = builder.Build();
app.MapGet("/v1/todos/{id}", ([AsParameters] TodoItemRequest request) =>
{
return request.todos.ToList().Find(todoItem => todoItem.Id == request.Id)
@ -33,31 +32,28 @@ struct TodoItemRequest
{
public int Id { get; set; }
[AsParameters]
public Todo[] todos { get; set; }
}
internal record Todo(int Id, string Task, DateTime DueDate);
[JsonSerializable(typeof(Todo[]))]
internal partial class AppJsonSerializerContext : JsonSerializerContext
{
}
// </snippet_1>
#elif RDG009F
// <snippet_1f>
using System.Text.Json.Serialization;
var builder = WebApplication.CreateSlimBuilder();
var todos = new[]
{
new Todo(1, "Write tests", DateTime.UtcNow.AddDays(2)),
new Todo(2, "Fix tests",DateTime.UtcNow.AddDays(1))
};
builder.Services.AddSingleton(todos);
builder.Services.ConfigureHttpJsonOptions(options =>
{
@ -66,7 +62,6 @@ builder.Services.ConfigureHttpJsonOptions(options =>
var app = builder.Build();
app.MapGet("/v1/todos/{id}", ([AsParameters] TodoItemRequest request) =>
{
return request.todos.ToList().Find(todoItem => todoItem.Id == request.Id)
@ -83,10 +78,8 @@ struct TodoItemRequest
public Todo[] todos { get; set; }
}
internal record Todo(int Id, string Task, DateTime DueDate);
[JsonSerializable(typeof(Todo[]))]
internal partial class AppJsonSerializerContext : JsonSerializerContext
{