private async Task <CategoryMsDbContext> InitializeContextAsync(bool seed) { var options = new DbContextOptionsBuilder <CategoryMsDbContext>() .UseInMemoryDatabase(databaseName: $"CategoryPrueba{Guid.NewGuid()}") .Options; var context = new CategoryMsDbContext(options); if (seed) { await FakeData.SeedFakeData(context); } return(context); }
public CategoryRepository(CategoryMsDbContext context) : base(context) { }
public Repository(CategoryMsDbContext context) { _context = context; }
public static async Task SeedFakeData(CategoryMsDbContext context) { await context.Categories.AddRangeAsync(FakeCategories()); await context.SaveChangesAsync(); }
public UnitOfWork(CategoryMsDbContext dbContext) { _dbContext = dbContext; Categories = new CategoryRepository(_dbContext); }