title: Issue mapping many to many relationship using EF Core fluent mapping
body: <p>I am trying to determine how to provide fluent configuration mappings for the below data model:</p>
  <p>Entities:</p>
  <ul>
  <li><code>Product</code></li>
  <li><code>Set</code></li>
  <li><code>Attribute</code></li>
  </ul>
  <p>Relationship requirements:</p>
  <ul>
  <li>Each Product has 1 Set</li>
  <li>Each Set has one or more Attributes</li>
  <li>Each Attribute can belong to one or more sets</li>
  </ul>
  <p>So, based on this, I have the following:</p>
  <ul>
  <li><code>Product (1...*) Set</code></li>
  <li><code>Set (*...*) Attribute</code>
  (This is represented by a join table <code>SetAttribute</code>) as follows:</li>
  </ul>
  <p><code>SetAttribute</code>:</p>
  <ul>
  <li><code>AttributeId</code> (FK,PK)</li>
  <li><code>AttributeSetId</code> (FK,PK)</li>
  <li><code>ProductId</code> (FK,PK)</li>
  <li><code>Value</code></li>
  </ul>
  <p>EF Core will not allow me to set the following mapping configuration:</p>
  <pre><code>modelBuilder.Entity&lt;Set&gt;()
     .HasMany(x =&gt; x.Attributes)
     .WithMany(x =&gt; x.Sets)
     .UsingEntity&lt;SetAttribute&gt;(
         j =&gt; j.HasOne(sa =&gt; sa.Attribute)
               .WithMany(x =&gt; x.SetAttributes)   
               .HasForeignKey(sa =&gt; sa.AttributeId),
         j =&gt; j.HasOne(sa =&gt; sa.Set)
               .WithMany(x =&gt; x.SetAttributes)
               .HasForeignKey(sa =&gt; sa.SetId),
         j =&gt; j.HasOne(sa =&gt; sa.Product)
               .WithMany()
               .HasForeignKey(sa =&gt; sa.ProductId),
         j =&gt;
         {
             j.HasKey(x =&gt; new {x.SetId, x.AttributeId, x.ProductId});
             j.Property(x =&gt; x.Value);
         });
  </code></pre>
  <p>I get an error:</p>
  <blockquote>
  <p>Cannot convert anonymous method block to delegate type 'delegate type' because some of the return types in the block are not implicitly convertible to the delegate return type.</p>
  </blockquote>
  <p>What am I missing?</p>
  <p>Thanks</p>