Skip to content

Commit cfaad6f

Browse files
authored
Update Configure.Db.Xkcd.cs
clean up code
1 parent 989af4f commit cfaad6f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

ExampleDataApis/Configure.Db.Xkcd.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ public static void SeedXkcd(this IDbConnection db)
1212
{
1313
var allLines = "static_data/xkcd-metadata.jsonl"
1414
.ReadAllText().Split("\n");
15-
using var jsonConfig = JsConfig.With(new Config
16-
{
15+
16+
using var jsonConfig = JsConfig.With(new Config {
1717
TextCase = TextCase.SnakeCase
1818
});
19+
1920
var comics = allLines
2021
.Where(x => !x.IsNullOrEmpty())
2122
.Select(JsonSerializer.DeserializeFromString<XkcdComic>)
@@ -27,15 +28,15 @@ public static void SeedXkcd(this IDbConnection db)
2728
foreach (var comic in comics)
2829
{
2930
var dimension = dimensions.FirstOrDefault(x => x?.Id == comic.Id);
30-
if (dimension == null)
31-
{
32-
continue;
33-
}
31+
if (dimension == null) continue;
32+
3433
comic.Width = dimension.Width;
3534
comic.Height = dimension.Height;
3635
}
3736

38-
if(db.CreateTableIfNotExists<XkcdComic>())
37+
if (db.CreateTableIfNotExists<XkcdComic>())
38+
{
3939
db.InsertAll(comics);
40+
}
4041
}
41-
}
42+
}

0 commit comments

Comments
 (0)