예제 #1
0
        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);
                }
            }
        }
예제 #2
0
 public RepositoryBase(ESXContext dbContext)
 {
     _dbContext = dbContext;
 }