RepositoryWrapper.cs 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 
  2. namespace Repository;
  3. public class RepositoryWrapper : IRepositoryWrapper
  4. {
  5. private RepositoryContext _context;
  6. private IBankAccountBalanceRepository _bankAccountBalance;
  7. private IBankOperationRepository _bankOperation;
  8. private ITransactionRepository _transaction;
  9. public IBankOperationRepository BankOperation {
  10. get {
  11. if(_bankOperation == null)
  12. _bankOperation = new BankOperationRepository(_context);
  13. return _bankOperation;
  14. }
  15. }
  16. public IBankAccountBalanceRepository BankAccountBalance {
  17. get {
  18. if (_bankAccountBalance == null)
  19. _bankAccountBalance = new BankAccountBalanceRepository(_context);
  20. return _bankAccountBalance;
  21. }
  22. }
  23. public ITransactionRepository Transaction {
  24. get {
  25. if (_transaction == null)
  26. _transaction = new TransactionRepository(_context);
  27. return _transaction;
  28. }
  29. }
  30. public RepositoryWrapper(RepositoryContext repositoryContext)
  31. {
  32. _context = repositoryContext;
  33. }
  34. public void Save()
  35. {
  36. _context.SaveChanges();
  37. }
  38. }