
namespace Repository;

public class RepositoryWrapper : IRepositoryWrapper
{
	private RepositoryContext _context;
	private IBankAccountBalanceRepository _bankAccountBalance;
	private IBankOperationRepository _bankOperation;
	private ITransactionRepository _transaction;

	public IBankOperationRepository BankOperation { 
		get { 
			if(_bankOperation == null) 
				_bankOperation = new BankOperationRepository(_context);
			return _bankOperation;
		}  
	}

	public IBankAccountBalanceRepository BankAccountBalance {
		get {
			if (_bankAccountBalance == null)
				_bankAccountBalance = new BankAccountBalanceRepository(_context);
			return _bankAccountBalance;
		}
	}
	public ITransactionRepository Transaction {
		get {
			if (_transaction == null)
				_transaction = new TransactionRepository(_context);
			return _transaction;
		}
	}

	public RepositoryWrapper(RepositoryContext repositoryContext)
	{
		_context = repositoryContext;
	}

	public void Save()
	{
		_context.SaveChanges();
	}




}

