public IngredientRepositoryTests() { _dbContextFactory = new DbContextInMemoryFactory(nameof(IngredientRepositoryTests)); using var dbx = _dbContextFactory.Create(); dbx.Database.EnsureCreated(); _ingredientRepositorySUT = new IngredientRepository(_dbContextFactory); }
public IngredientRepository(INamedDbContextFactory <CookBookDbContext> dbContextFactory) : base(dbContextFactory, IngredientMapper.MapDetailModelToEntity, IngredientMapper.MapEntityToListModel, IngredientMapper.MapEntityToDetailModel, null, null, null) { }
public RecipeRepository(INamedDbContextFactory <CookBookDbContext> dbContextFactory) : base(dbContextFactory, RecipeMapper.MapDetailModelToEntity, RecipeMapper.MapEntityToListModel, RecipeMapper.MapEntityToDetailModel, new Func <RecipeEntity, IEnumerable <IEntity> >[] { entity => entity.Ingredients }, entities => entities.Include(entity => entity.Ingredients) .ThenInclude(entity => entity.Ingredient), null) { }
public RepositoryBase(INamedDbContextFactory <CookBookDbContext> dbContextFactory, Func <TDetailModel, TEntity> mapEntity, Func <TEntity, TListModel> mapListModel, Func <TEntity, TDetailModel> mapDetailModel, Func <TEntity, IEnumerable <IEntity> >[] collectionsToBeSynchronized, Func <IQueryable <TEntity>, IIncludableQueryable <TEntity, object> > detailIncludes, Func <IQueryable <TEntity>, IIncludableQueryable <TEntity, object> > listIncludes) { DbContextFactory = dbContextFactory; MapEntity = mapEntity; MapListModel = mapListModel; MapDetailModel = mapDetailModel; CollectionsToBeSynchronized = collectionsToBeSynchronized; DetailIncludes = detailIncludes; ListIncludes = listIncludes; }
public IngredientRepository(INamedDbContextFactory <CookBookDbContext> dbContextFactory) { _dbContextFactory = dbContextFactory; }