Beispiel #1
0
        public async Task SeedAsync(ActivityDbContext context, ILogger <ActivityDbContextSeed> logger)
        {
            var policy = CreatePolicy(logger, nameof(ActivityDbContextSeed));

            await policy.ExecuteAsync(async() =>
            {
                using (context)
                {
                    context.Database.Migrate();

                    if (!context.ActivityStatuses.Any())
                    {
                        context.ActivityStatuses.AddRange(ActivityStatus.List());
                    }

                    await context.SaveChangesAsync();
                }
            });
        }