//https://exceptionnotfound.net/ef-core-inmemory-asp-net-core-store-database/
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new LavanderiaContext(
                       serviceProvider.GetRequiredService <DbContextOptions <LavanderiaContext> >()))
            {
                // Look for any board games.
                if (context.Usuarios.Any())
                {
                    return;   // Data was already seeded
                }

                context.Usuarios.AddRange(
                    new Usuario
                {
                    Id    = 1,
                    Login = "******",
                    Senha = "Hasbro",
                },
                    new Usuario
                {
                    Id    = 2,
                    Login = "******",
                    Senha = "Hasbro",
                },
                    new Usuario
                {
                    Id    = 3,
                    Login = "******",
                    Senha = "Days of Wonder",
                },
                    new Usuario
                {
                    Id    = 4,
                    Login = "******",
                    Senha = "Catan Studio",
                },
                    new Usuario
                {
                    Id    = 5,
                    Login = "******",
                    Senha = "Z-Man Games",
                },
                    new Usuario
                {
                    Id    = 6,
                    Login = "******",
                    Senha = "Jax Games",
                });

                context.SaveChanges();
            }
        }
Example #2
0
 public Repository(LavanderiaContext context)
 {
     _context = context;
     _dbSet   = _context.Set <TEntity>();
 }
Example #3
0
 public UnitOfWork(LavanderiaContext context)
 {
     _context = context;
 }
 public ClienteRepository(LavanderiaContext context) : base(context)
 {
 }
 public OrdemServicoRepository(LavanderiaContext context) : base(context)
 {
 }
Example #6
0
 public UsuarioRepository(LavanderiaContext context) : base(context)
 {
 }
 public ItemOrdemRepository(LavanderiaContext context) : base(context)
 {
 }
 public ClientesController(LavanderiaContext context)
 {
     _context = context;
 }