public static WingtipToysContext GetDbContext() { if (DbContext == null) { var options = new DbContextOptionsBuilder <WingtipToysContext>() .UseInMemoryDatabase("wingtiptoys"); var inMemoryDbContext = new WingtipToysContext(options.Options); var products = new List <Product> { ProductSeed.RedCar, ProductSeed.BlueCar, ProductSeed.BigBoat, ProductSeed.SmallBoat }; var categories = new List <Category> { CategorySeed.BoatCategory, CategorySeed.CarCategory }; inMemoryDbContext.AddRange(products); inMemoryDbContext.AddRange(categories); inMemoryDbContext.SaveChanges(); DbContext = inMemoryDbContext; } return(DbContext); }
public AdminController(WingtipToysContext context) { _context = context; }
public CategoryRepository(WingtipToysContext wingtipToysDbContext) { this._wingtipToysDbContext = wingtipToysDbContext; }
public ShoppingCart(CocoonSession session, WingtipToysContext db) { _session = session; _db = db; }
public AdminController(WingtipToysContext dbContext) { _dbContext = dbContext; }
public ProductRepository(WingtipToysContext wingtipToysDbContext) { this._wingtipToysDbContext = wingtipToysDbContext; }