public T GetRepo <T>(CustomerDbContext context)
        {
            dynamic result = null;

            if (typeof(T) == typeof(IAddressRepository))
            {
                result = new AddressRepository(context);
            }
            if (typeof(T) == typeof(IContactRepository))
            {
                result = new ContactRepository(context);
            }
            if (typeof(T) == typeof(ICustomerRepository))
            {
                result = new CustomerRepository(context);
            }
            if (typeof(T) == typeof(IAddressTypeRepository))
            {
                result = new AddressTypeRepository(context);
            }
            if (typeof(T) == typeof(IContactTypeRepository))
            {
                result = new ContactTypeRepository(context);
            }
            if (typeof(T) == typeof(ICustomerAddressRepository))
            {
                result = new CustomerAddressRepository(context);
            }
            if (typeof(T) == typeof(ICustomerContactsRepository))
            {
                result = new CustomerContactsRepository(context);
            }
            return((T)result);
        }
Example #2
0
        public UnitOfWork()
        {
            // Initialisiere den Context und die Repos
            _context = new EasyPeasyContext();
            //_context.Configuration.LazyLoadingEnabled = false;

            Addresses      = new AddressRepository(_context);
            AddressesTypes = new AddressTypeRepository(_context);
        }
Example #3
0
 public BusinessEntityRepository(ERPDatabaseEntities context)
 {
     EntityRepository                = new EntityRepository(context);
     AddressRepository               = new AddressRepository(context);
     AddressTypeRepository           = new AddressTypeRepository(context);
     BusinessEntityAddressRepository = new BusinessEntityAddressRepository(context);
     DistrictRepository              = new DistrictRepository(context);
     ProvinceRepository              = new ProvinceRepository(context);
     WardRepository = new WardRepository(context);
 }
Example #4
0
        public ContactManager(AddressRepository addressRepository,
                              AddressTypeRepository addressTypeRepository,
                              PhoneRepository phoneRepository,
                              PhoneTypeRepository phoneTypeRepository,
                              ProfileAddressRepository profileAddressRepository,
                              ProfilePhoneRepository profilePhoneRepository,
                              ProfileRepository profileRepository)
        {
            if (addressRepository == null)
            {
                throw new ArgumentNullException("addressRepository");
            }

            if (addressTypeRepository == null)
            {
                throw new ArgumentNullException("addressTypeRepository");
            }

            if (phoneRepository == null)
            {
                throw new ArgumentNullException("phoneRepository");
            }

            if (phoneTypeRepository == null)
            {
                throw new ArgumentNullException("phoneTypeRepository");
            }

            if (profileAddressRepository == null)
            {
                throw new ArgumentNullException("profileAddressRepository");
            }

            if (profilePhoneRepository == null)
            {
                throw new ArgumentNullException("profilePhoneRepository");
            }

            if (profileRepository == null)
            {
                throw new ArgumentNullException("profileRepository");
            }

            _addressRepository        = addressRepository;
            _addressTypeRepository    = addressTypeRepository;
            _phoneRepository          = phoneRepository;
            _phoneTypeRepository      = phoneTypeRepository;
            _profileAddressRepository = profileAddressRepository;
            _profilePhoneRepository   = profilePhoneRepository;
            _profileRepository        = profileRepository;
        }
        public ContactManager(AddressRepository addressRepository,
                              AddressTypeRepository addressTypeRepository,
                              PhoneRepository phoneRepository,
                              PhoneTypeRepository phoneTypeRepository,
                              ProfileAddressRepository profileAddressRepository,
                              ProfilePhoneRepository profilePhoneRepository,
                              ProfileRepository profileRepository)
        {
            if (addressRepository == null)
                throw new ArgumentNullException("addressRepository");

            if (addressTypeRepository == null)
                throw new ArgumentNullException("addressTypeRepository");

            if (phoneRepository == null)
                throw new ArgumentNullException("phoneRepository");

            if (phoneTypeRepository == null)
                throw new ArgumentNullException("phoneTypeRepository");

            if (profileAddressRepository == null)
                throw new ArgumentNullException("profileAddressRepository");

            if (profilePhoneRepository == null)
                throw new ArgumentNullException("profilePhoneRepository");

            if (profileRepository == null)
                throw new ArgumentNullException("profileRepository");

            _addressRepository = addressRepository;
            _addressTypeRepository = addressTypeRepository;
            _phoneRepository = phoneRepository;
            _phoneTypeRepository = phoneTypeRepository;
            _profileAddressRepository = profileAddressRepository;
            _profilePhoneRepository = profilePhoneRepository;
            _profileRepository = profileRepository;
        }