示例#1
0
        private async Task SeedAsync()
        {
            if (_db.Books.Any())
            {
                return;
            }

            // add your code
            var books = new List <Book>
            {
                new Book {
                    Title = "book1", Category = "music", TimePosted = DateTime.Now
                }
            };

            _db.Books.AddRange(books);

            await _db.SaveChangesAsync();
        }
示例#2
0
 public async Task <int> SaveChangesAsync()
 {
     return(await _db.SaveChangesAsync());
 }