public LipwigData(ILipwigContext dbContext, IEfRepository <User> usersRepository, IEfRepository <Income> incomesRepository, IEfRepository <Expense> expensesRepository, IEfRepository <Currency> currenciesRepository) { Guard.WhenArgument <ILipwigContext>(dbContext, "Database context cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <User> >(usersRepository, "Users repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Income> >(incomesRepository, "Incomes repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Expense> >(expensesRepository, "Expenses repository cannot be null.") .IsNull() .Throw(); Guard.WhenArgument <IEfRepository <Currency> >(currenciesRepository, "Currencies repository cannot be null.") .IsNull() .Throw(); this.dbContext = dbContext; this.usersRepository = usersRepository; this.incomesRepository = incomesRepository; this.expensesRepository = expensesRepository; this.currenciesRepository = currenciesRepository; }
public EfRepository(ILipwigContext dbContext) { Guard.WhenArgument <ILipwigContext>(dbContext, "Database context cannot be null.") .IsNull() .Throw(); this.dbContext = dbContext; this.dbSet = this.dbContext.Set <T>(); }