title: Owned Entities when updating efCore from 2.2 to 3.1
body: <p>I'm migrating an existing project based on DDD design principles from efcore 2.2 to efcore 3.1. Database setup is based on the series of articles that Julie Lerman wrote a few years ago.</p>
  
  <p>Generally this has been fine but I'm struggle to resolve an issued with owned entities and in particular this error message:</p>
  
  <pre><code>InvalidOperationException: The type 'ApplicationCore.Entities.UserAggregate.Email' cannot be configured as non-owned because an owned entity type with the same name already exists
  </code></pre>
  
  <p>The two entities are:</p>
  
  <pre><code>public class User
  {
      public int Id { get; private set; }
      public Guid GuidId { get; private set; }
      public Email Email {get; private set;}
  }
  </code></pre>
  
  <p>and it's "owned" entity</p>
  
  <pre><code>public class Email
  {
      public string Address { get; private set; }
  }
  </code></pre>
  
  <p>Formerly in EfCore 2.2 the configuration was:</p>
  
  <pre><code>private static void ConfigureUser(EntityTypeBuilder&lt;User&gt; builder)
  {
      builder.HasKey(s =&gt; s.Id);
  
      builder.Property(s =&gt; s.GuidId)
              .IsRequired();
  
      builder.OwnsOne(u =&gt; u.Email);
  }
  </code></pre>
  
  <p>As far as I understand what I should be doing in efcore3.1 is to update this to be:</p>
  
  <pre><code>private static void ConfigureUser(EntityTypeBuilder&lt;User&gt; builder)
  {
      builder.HasKey(s =&gt; s.Id);
  
      builder.Property(s =&gt; s.GuidId)
              .IsRequired();
  
      builder.OwnsOne(u =&gt; u.Email).WithOwner();
  }
  </code></pre>
  
  <p>As well as this configure method there are several more for the other entities within the <code>OnModelCreating()</code> method</p>
  
  <pre><code>protected override void OnModelCreating(ModelBuilder builder)
  {
      builder.Entity&lt;ForecastSetup&gt;(ConfigureForecastSetup);
      …
      builder.Entity&lt;User&gt;(ConfigureUser);
  
      // Remove internal property
      foreach (var entityType in builder.Model.GetEntityTypes())
      {
          builder.Entity(entityType.Name).Ignore("IsDirty");
      }
  }
  </code></pre>
  
  <p>The exception will be thrown from the <code>builder.Entity(entityType.Name).Ignore("IsDirty")</code> line.</p>
  
  <p>And that's it. However, this makes zero difference and the same error reappears.</p>
  
  <p>I can't run add-migrations to test if there is something else being setup as the exception is being thrown and I'm unsure as to what will happen if I delete the ContextModelSnapshot…</p>