Exemplo n.º 1
0
            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();
                }
            }
Exemplo n.º 2
0
 public RepositoryWithTypedId(TinyShoppingCartDbContext dbContext)
 {
     _dbContext = dbContext;
     _dbSet     = dbContext.Set <TEntity>();
 }