コード例 #1
0
        private async Task InitGenres(IGenreRepository genreRepository)
        {
            int genresCount = await genreRepository.GetCount();

            if (genresCount != 0)
            {
                return;
            }

            var genres = new List <Genre>
            {
                new Genre {
                    Title = "Prose"
                },
                new Genre {
                    Title = "Novel"
                },
                new Genre {
                    Title = "Story"
                },
                new Genre {
                    Title = "Verse"
                },
            };

            await genreRepository.AddRangeAsync(genres);
        }