What is the proper way to inject a data access dependency for lazy loading?
问题 What is the proper way to inject a data access dependency when I do lazy loading? For example I have the following class structure class CustomerDao : ICustomerDao public Customer GetById(int id) {...} class Transaction { int customer_id; //Transaction always knows this value Customer _customer = null; ICustomerDao _customer_dao; Customer GetCustomer() { if(_customer == null) _customer = _customer_dao.GetById(_customer_id); return _customer } How do I get the reference to _customer_dao into