title: EF: The property 'Street' is not a declared property on type 'Address'
body: <p>I'm getting the following error when I try to get all the <code>Suppliers</code> with Entity Framework 6.1.</p>
  
  <blockquote>
    <p>The property 'Street' is not a declared property on type 'Address'.
    Verify that the property has not been explicitly excluded from the
    model by using the Ignore method or NotMappedAttribute data annotation. Make sure that it is a valid primitive property.</p>
  </blockquote>
  
  <p>My entities look like this:</p>
  
  <p>Supplier.cs:</p>
  
  <pre><code>public class Supplier : AggregateRoot
  {
      // public int Id: defined in AggregateRoot class
  
      public string CompanyName { get; private set; }
      public ICollection&lt;Address&gt; Addresses { get; private set; }
  
      protected Supplier() { }
  
      public Supplier(string companyName)
      {
          CompanyName = companyName;
          Addresses = new List&lt;Address&gt;();
      }
  
      public void ChangeCompanyName(string newCompanyName)
      {
          CompanyName = newCompanyName;
      }
  }
  </code></pre>
  
  <p>Address.cs:</p>
  
  <pre><code>public class Address : ValueObject&lt;Address&gt;
  {
      // public int Id: defined in ValueObject class
  
      public string Street { get; }
      public string Number { get; }
      public string Zipcode { get; }
  
      protected Address() { }
  
      protected override bool EqualsCore(Address other)
      {
          // removed for sake of simplicity
      }
  
      protected override int GetHashCodeCore()
      {
          // removed for sake of simplicity
      }
  }
  </code></pre>
  
  <p>I also have two mappings defined:</p>
  
  <p>SupplierMap.cs</p>
  
  <pre><code>public class SupplierMap : EntityTypeConfiguration&lt;Supplier&gt;
  {
      public SupplierMap()
      {
          // Primary Key
          this.HasKey(t =&gt; t.Id);
  
          // Properties
          this.Property(t =&gt; t.CompanyName).IsRequired();
      }
  }
  </code></pre>
  
  <p>AddressMap.cs</p>
  
  <pre><code>public class AddressMap : EntityTypeConfiguration&lt;Address&gt;
  {
      public AddressMap()
      {
          // Primary Key
          this.HasKey(t =&gt; t.Id);
  
          // Properties
          this.Property(t =&gt; t.Street).IsRequired().HasMaxLength(50);
          this.Property(t =&gt; t.Number).IsRequired();
          this.Property(t =&gt; t.Zipcode).IsOptional();
      }
  }
  </code></pre>
  
  <p>But when I run the following code I gives me the error described above:</p>
  
  <pre><code>using (var ctx = new DDDv1Context())
  {
      var aaa = ctx.Suppliers.First(); // Error here...
  }
  </code></pre>
  
  <p>The code works when I remove the <code>ICollection</code> from the <code>Supplier.cs</code> class and also remove the mapping class from my db context:</p>
  
  <pre><code>public class DDDv1Context : DbContext
  {
      static DDDv1Context()
      {
          Database.SetInitializer&lt;DDDv1Context&gt;(null);
      }
  
      public DbSet&lt;Supplier&gt; Suppliers { get; set; }
      public DbSet&lt;Address&gt; Addresses { get; set; } //Can leave this without problems
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
          modelBuilder.Configurations.Add(new SupplierMap());
  
          // Now code works when trying to get supplier
          //modelBuilder.Configurations.Add(new AddressMap());
      }
  
  }
  </code></pre>
  
  <p>Why does the code give an error when I try to use it with the <code>Address</code> class and <code>AddresMap</code> class?</p>