Esempio n. 1
0
 /// <summary>
 /// Constructors for the various repositories held by the Unit of Work, built from the same DbContext.
 /// </summary>
 /// <param name="context">The DbContext to be used when creating the repositories.</param>
 public UnitOfWork(CookingpapaContext context)
 {
     _context               = context;
     Cookbooks              = new CookbookRepository(_context);
     Recipes                = new RecipeRepository(_context);
     RecipeIngredients      = new Repository <RecipeIngredient>(_context);
     RecipeIngredientGroups = new RecipeIngredientGroupRepository(_context);
     RecipeMeasurements     = new Repository <RecipeMeasurement>(_context);
     RecipeOrigins          = new Repository <RecipeOrigin>(_context);
     RecipeReviews          = new ReviewRepository(_context);
     Users = new UserRepository(_context);
 }
 public CookbooksController()
 {
     cookbookRepository = new CookbookRepository();
 }