Generate a composite unique constraint/index, in EF Core : <p>I need a composite unique constraint for my entity's <code>Name</code> property, which is unique per <code>Category</code> (for which it has an FK).</p>

<p>So something like this:</p>

<pre><code>entityTypeBuilder
  .HasIndex(i =&gt; new { i.Name, i.Category.Id })
  .IsUnique();
</code></pre>

<p>But this fails when I generate a migration, because of the <code>Category.Id</code> navigation property.</p>

<p>I know I can hardcode the values as strings, but I don't want to lose the static typing.</p>

<p>What options do I have?</p>
