public EfRepository(ISmarterThanYouContext dbContext) { Guard.WhenArgument <ISmarterThanYouContext>(dbContext, "Database context cannot be null.") .IsNull() .Throw(); this.dbContext = dbContext; this.dbSet = this.dbContext.Set <T>(); }
public SmarterThanYouData(ISmarterThanYouContext dbContext, IEfRepository <Answer> answersRepository, IEfRepository <Category> categoriesRepository, IEfRepository <Question> questionsRepository, IEfRepository <Score> scoresRepository, IEfRepository <User> usersRepository) { Guard.WhenArgument <ISmarterThanYouContext>(dbContext, "Database context cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Answer> >(answersRepository, "Answers repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Category> >(categoriesRepository, "Categories repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Question> >(questionsRepository, "Questions repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Score> >(scoresRepository, "Scores repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <User> >(usersRepository, "Users repository cannot be null.") .IsNull() .Throw(); this.dbContext = dbContext; this.answersRepository = answersRepository; this.categoriesRepository = categoriesRepository; this.questionsRepository = questionsRepository; this.scoresRepository = scoresRepository; this.usersRepository = usersRepository; }