private void CreateTestData() { using (var context = new TinyShoppingCartDbContext(_options)) { var dbSet = context.Set <ProductCategory>(); dbSet.Add(new ProductCategory { Id = 1, Name = "Men" }); dbSet.Add(new ProductCategory { Id = 2, Name = "Women" }); dbSet.Add(new ProductCategory { Id = 3, Name = "Clothes", ParentId = 1 }); context.Database.UseTransaction(_transaction); context.SaveChanges(); } }
public RepositoryWithTypedId(TinyShoppingCartDbContext dbContext) { _dbContext = dbContext; _dbSet = dbContext.Set <TEntity>(); }