title: Entity Framework - Eager loading, all properties to list
body: <p>I have a simple project in which i have the following model.</p>
  
  <pre><code>Customer 1---&gt;N Addresses N&lt;----1 City N&lt;----1 Country
                       ^
                      N|
                       |
  AddressTypes 1-------+
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>public partial class Customer {
          public Customer() {
              this.Address = new HashSet&lt;Address&gt;();
          }
          public int Id {get;set;}
          public string FirstName {get;set;}
          public string LastName {get;set;}
          public System.DateTime Birthday {get;set;}
  
          public virtual ICollection&lt;Address&gt; Address {get;set;}
      }
  
  public partial class Address {
          public int Id {get;set;}
          public string Street {get;set;}
          public string Area {get;set;}
          public string Post {get;set;}
          public bool isDeleted {get;set;}
  
          public virtual Customer Customer {get;set;}
          public virtual City City {get;set;}
          public virtual AddressType AddressType {get;set;}
      }
  
  public partial class AddressType {
          public AddressType() {
              this.Address = new HashSet&lt;Address&gt;();
          }
          public int Id {get;set;}
          public string Name {get;set;}
  
          public virtual ICollection&lt;Address&gt; Address {get;set;}
      }
  
  public partial class Country {
          public Country() {
              this.City = new HashSet&lt;City&gt;();
          }
          public int Id {get;set;}
          public string Name {get;set;}
  
          public virtual ICollection&lt;City&gt; City {get;set;}
      }
  
  public partial class City {
          public City() {
              this.Address = new HashSet&lt;Address&gt;();
          }
          public int Id {get;set;}
          public string Name {get;set;}
  
          public virtual ICollection&lt;Address&gt; Address {get;set;}
          public virtual Country Country {get;set;}
      }
  
  
  public partial class MyModelContext : DbContext {
          public MyModelContext()
              : base("name=MyModelContext") {
              this.Configuration.LazyLoadingEnabled = true;
              this.Configuration.ProxyCreationEnabled = false;
          }
  
          public virtual DbSet&lt;Country&gt; Countries {get;set;}
          public virtual DbSet&lt;City&gt; Cities {get;set;}
          public virtual DbSet&lt;AddressType&gt; AddressTypes {get;set;}
          public virtual DbSet&lt;Address&gt; Addresses {get;set;}
          public virtual DbSet&lt;Customer&gt; Customers {get;set;}
      }
  </code></pre>
  
  <p>I want to return a list of customers. At first i tried to do a simple <code>Customers.ToList()</code> but i was getting an <code>exception during serialization</code> and i read that this was caused by cyclical references. So i added </p>
  
  <pre><code>Configuration.LazyLoadingEnabled = true;
  Configuration.ProxyCreationEnabled = false;
  </code></pre>
  
  <p>and then i was able to get the customers but without the addresses. I tried doing:</p>
  
  <pre><code>public List&lt;Customer&gt; getCustomers() {
      MyModelContext db = new MyModelContext();
      return db.Customers.Include("Address").ToList();
  }
  </code></pre>
  
  <p>but i don't know how to retrieve ALL the properties. I want to get in the list every customer and his addresses including the city, country, addresstype of each address. How can i do it?</p>