Пример #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new EmpleatContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <EmpleatContext> >()))
            {
                // Look for any movies.
                if (context.Empleats.Any())
                {
                    return;   // DB has been seeded
                }

                context.Empleats.AddRange(
                    new Empleat
                {
                    Nom    = "Ismael",
                    Cognom = "Anaya",
                    Càrrec = "CTO",
                    Sou    = "40000"
                },
                    new Empleat
                {
                    Nom    = "Patricia",
                    Cognom = "Costa",
                    Càrrec = "CEO",
                    Sou    = "60000"
                }
                    );
                context.SaveChanges();
            }
        }
Пример #2
0
 public Data(EmpleatContext context)
 {
     _context = context;
 }