File tree Expand file tree Collapse file tree
ExampleDataApis.ServiceModel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,4 +18,7 @@ public class XkcdComic
1818 public string ExplainedUrl { get ; set ; }
1919 public string Transcript { get ; set ; }
2020 public string Explanation { get ; set ; }
21+
22+ public int Width { get ; set ; }
23+ public int Height { get ; set ; }
2124}
Original file line number Diff line number Diff line change @@ -20,6 +20,16 @@ public static void SeedXkcd(this IDbConnection db)
2020 . Where ( x => ! x . IsNullOrEmpty ( ) )
2121 . Select ( JsonSerializer . DeserializeFromString < XkcdComic > )
2222 . ToList ( ) ;
23+
24+ var dimensions = "static_data/xkcd-dimensions.jsonl"
25+ . ReadAllText ( ) . FromJson < List < XkcdComic > > ( ) ;
26+
27+ foreach ( var comic in comics )
28+ {
29+ var dimension = dimensions . First ( x => x . Id == comic . Id ) ;
30+ comic . Width = dimension . Width ;
31+ comic . Height = dimension . Height ;
32+ }
2333
2434 if ( db . CreateTableIfNotExists < XkcdComic > ( ) )
2535 db . InsertAll ( comics ) ;
You can’t perform that action at this time.
0 commit comments