public static async Task SeedAsync(ESXContext context, int?retry = 0) { int retryForAvailability = retry.Value; try { if (!context.Brands.Any()) { context.Brands.AddRange( GetPreconfiguredBrands()); await context.SaveChangesAsync(); } if (!context.Assets.Any()) { context.Assets.AddRange( GetPreconfiguredAssets()); await context.SaveChangesAsync(); } } catch (Exception) { if (retryForAvailability < 10) { retryForAvailability++; await SeedAsync(context, retryForAvailability); } } }
public RepositoryBase(ESXContext dbContext) { _dbContext = dbContext; }