private void InitializeContext() { var builder = new DbContextOptionsBuilder<BuckeyeStoreContext>() .UseInMemoryDatabase(); var context = new BuckeyeStoreContext(builder.Options); var products = Enumerable.Range(1, 10) .Select(i => new Product { Id = i, Name = $"T-Shirt{i}", Brand = "Nike" }); context.Products.AddRange(products); int changed = context.SaveChanges(); db = context; }
public ProductsController(BuckeyeStoreContext context) { this.db = context; }