title: What is the proper way to inject a data access dependency for lazy loading?
body: <p>What is the proper way to inject a data access dependency when I do lazy loading?</p>
  
  <p>For example I have the following class structure</p>
  
  <pre><code>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
    }
  </code></pre>
  
  <p>How do I get the reference to _customer_dao into the transaction object?  Requiring it for the constructor seems like it wouldn't really make sense if I want the Transaction to at least look like a POCO.  Is it ok to have the Transaction object reference the Inversion of Control Container directly?  That also seems awkward too.</p>
  
  <p>How do frameworks like NHibernate handle this?</p>