title: EF Core owned entity shadow PK causes null constraint violation with SQLite
body: <p>I have a <code>Comment</code> owned entity type:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Comment {    // owned entity type
    public Comment(string text) { Text = text; }
    public string Text { get; private set; }
  }
  
  public class Post {
    public Post(string content) { Content = content; }
    public long Id { get; private set; }
    public string Content { get; private set; }
    public ICollection&lt;Comment&gt; Comments { get; private set; } = new HashSet&lt;Comment&gt;();
  }
  </code></pre>
  <p>And <code>Post</code>'s configuration includes:</p>
  <pre class="lang-cs prettyprint-override"><code>builder.OwnsMany(x =&gt; x.Comments, x =&gt; {
    x.Property(y =&gt; y.Text).IsRequired();
  });
  </code></pre>
  <p>The seeding code includes this:</p>
  <pre class="lang-cs prettyprint-override"><code>var post = new Post(&quot;content&quot;);
  post.Comments.Add(new Comment(&quot;comment1&quot;));
  post.Comments.Add(new Comment(&quot;comment2&quot;));
  await _context.AddAsync(post);
  await _context.SaveChangesAsync();
  </code></pre>
  <p>When I use the postgres provider, I can successfully create, seed and edit the database.</p>
  <p>When I use the sqlite provider, I can successfully create the database, but when I try to seed it I get this error:</p>
  <blockquote>
  <p>Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.<br />
  ---&gt; Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 19: 'NOT NULL constraint failed: Comment.Id'.</p>
  </blockquote>
  <p>The <a href="https://docs.microsoft.com/en-us/ef/core/modeling/owned-entities#implicit-keys" rel="nofollow noreferrer">docs say</a> that the owned table has an implicit key, which explains the complaint about <code>Comment.Id</code>.</p>
  <p>But why does this happen only for sqlite, and <em>how do I fix it</em>?</p>