Ejemplo n.º 1
0
 public CustomerService(IRepository <Customer> customerRepository,
                        IRepository <Company> companyRepository,
                        ICreditCheckRule creditCheckRule,
                        IValidator <Customer> customerValidator)
 {
     _customerRepository = customerRepository;
     _companyRepository  = companyRepository;
     _creditCheckRule    = creditCheckRule;
     _customerValidator  = customerValidator;
 }
Ejemplo n.º 2
0
 public CustomerService()
 {
     //I am having this constructor here to maintain backward compatibility with previous consumer of the service.
     //Another option (cleaner) would have been to wrap my new CustomerService (named differently) into the
     //original CustomerService
     //Obviously, by having this default constructor, I am breaking the dependency injection principle...
     _customerRepository = new CustomerRepository();
     _companyRepository  = new CompanyRepository();
     _creditCheckRule    = new CreditCheckRule(new CustomerCreditServiceClient(), _companyRepository);
     _customerValidator  = new CustomerValidator();
 }