public static void Initialize(IServiceProvider serviceProvider)
        {
            var contextOptions = serviceProvider.GetRequiredService <DbContextOptions <LifeBoatMediatRDbContext> >();

            using (var dbContext = new LifeBoatMediatRDbContext(contextOptions))
            {
                SeedData(dbContext);
            }
        }
        static void SeedData(LifeBoatMediatRDbContext dbContext)
        {
            if (dbContext.User.Any())
            {
                return;
            }

            var random = new Random();

            dbContext.User.AddRange(
                new User(random.Next(), "Test1", "*****@*****.**", DateTime.Now.AddDays(-15)),
                new User(random.Next(), "Test2", "*****@*****.**", DateTime.Now.AddDays(-20)),
                new User(random.Next(), "Test3", "*****@*****.**", DateTime.Now.AddDays(-25)),
                new User(random.Next(), "Test4", "*****@*****.**", DateTime.Now.AddDays(-30))
                );

            dbContext.SaveChanges();
        }
 public static void Initialize(LifeBoatMediatRDbContext dbContext)
 {
     SeedData(dbContext);
 }