Skip to content

Commit 736af18

Browse files
committed
Fix warnings
1 parent 66a9bcc commit 736af18

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

sample_dotnet/ExampleAPI/WeatherForecast.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public class WeatherForecast
88

99
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1010

11-
public string Summary { get; set; }
11+
public required string Summary { get; set; }
1212
}

sample_dotnet/src/Infrastructure/Context/BloggingContext.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public void Configure(EntityTypeBuilder<Post> entity)
5959
public class Blog
6060
{
6161
public int BlogId { get; set; }
62-
public string Url { get; set; }
62+
public required string Url { get; set; }
6363

64-
public List<Post> Posts { get; } = new();
64+
public List<Post> Posts { get; } = [];
6565
}
6666

6767
[Table("Users")]
@@ -71,7 +71,7 @@ public class User
7171
public long Id { get; set; }
7272

7373
[Required]
74-
public string Name { get; set; }
74+
public required string Name { get; set; }
7575
}
7676

7777
[Table("Posts")]
@@ -81,14 +81,14 @@ public class Post
8181
public long Id { get; set; }
8282

8383
[Required]
84-
public string Title { get; set; }
84+
public required string Title { get; set; }
8585

8686
[Required]
87-
public User User { get; set; }
87+
public required User User { get; set; }
8888

89-
public List<Tag> Tags { get; } = new List<Tag>();
89+
public List<Tag> Tags { get; } = [];
9090

91-
public List<PostTag> PostTags { get; } = new List<PostTag>();
91+
public List<PostTag> PostTags { get; } = [];
9292

9393
public int? Ranking { get; set; }
9494
}
@@ -101,11 +101,11 @@ public class Tag
101101

102102
[Required]
103103
[MaxLength(64)]
104-
public string Name { get; set; }
104+
public required string Name { get; set; }
105105

106-
public List<Post> Posts { get; } = new List<Post>();
106+
public List<Post> Posts { get; } = [];
107107

108-
public List<PostTag> PostTags { get; } = new List<PostTag>();
108+
public List<PostTag> PostTags { get; } = [];
109109
}
110110

111111
[Table("PostTags")]
@@ -115,11 +115,11 @@ public class PostTag
115115
public long PostId { get; set; }
116116

117117
[Required]
118-
public Post Post { get; set; }
118+
public required Post Post { get; set; }
119119

120120
[Required]
121-
public long TagId { get; set; }
121+
public required long TagId { get; set; }
122122

123123
[Required]
124-
public Tag Tag { get; set; }
124+
public required Tag Tag { get; set; }
125125
}

0 commit comments

Comments
 (0)