Exemplo n.º 1
0
 public static async Task SeedAsync(AlbumDbContext albumDbContext)
 {
     if (!albumDbContext.Albums.Any())
     {
         await albumDbContext.Albums.AddRangeAsync(await GetAlbums());
     }
     if (!albumDbContext.Photos.Any())
     {
         await albumDbContext.Photos.AddRangeAsync(await GetPhotos());
     }
     await albumDbContext.SaveChangesAsync();
 }
Exemplo n.º 2
0
 public AsyncRepository(AlbumDbContext dbContext)
 {
     _dbContext = dbContext;
     _dbSet     = dbContext.Set <T>();
 }