Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ATMContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <ATMContext> >()))
            {
                if (context.CreditCards.Any())
                {
                    return;
                }

                context.CreditCards.AddRange(ATMContext.GetSeedingCards());
                context.SaveChanges();
            }
        }