title: Blazor 6, EF Core and many to many - get related data error
body: <p>I have a many-to-many relationship.</p>
  <p>I have 2 entitys &quot;Projekt&quot; and &quot;Personuppgift&quot; that both have this row :</p>
  <pre><code>public virtual ICollection&lt;ProjektPersonuppgift&gt; ProjektPersonuppgifter { get; set; }
  </code></pre>
  <p>Then I have</p>
  <pre><code>public class ProjektPersonuppgift
  {
      public int ProjektId { get; set; }
      public Projekt Projekt { get; set; }
  
      public int PersonuppgiftId { get; set; }
  
      public Personuppgift Personuppgift { get; set; }
  
  }
  </code></pre>
  <p>My db context :</p>
  <pre><code>builder.HasKey(x =&gt; new { x.ProjektId, x.PersonuppgiftId });
  
          builder.HasOne(pt =&gt; pt.Projekt)
              .WithMany(p =&gt; p.ProjektPersonuppgifter)
              .HasForeignKey(pt =&gt; pt.ProjektId);
  
          builder.HasOne(pt =&gt; pt.Personuppgift)
              .WithMany(p =&gt; p.ProjektPersonuppgifter)
              .HasForeignKey(pt =&gt; pt.PersonuppgiftId);
  </code></pre>
  <p>I have a page where I show data for Projekt, and now I want to get all related Personuppgift for this Projekt</p>
  <p>I have a repository and this function :</p>
  <pre><code>public async Task&lt;List&lt;Personuppgift&gt;&gt; GetProjektAsync(int ProjektId)
  {
      return await _db.Personuppgifter
          .Where(x =&gt; x.ProjektPersonuppgifter.Any(c =&gt; c.ProjektId == ProjektId))
          .OrderBy(o =&gt; o.Namn)
          .ToListAsync();
  }
  </code></pre>
  <p>But this last code doesn't work.</p>
  <blockquote>
  <p>System.InvalidOperationException: The LINQ expression
  'DbSet()
  .Where(p =&gt; DbSet()
  .Where(p0 =&gt; EF.Property&lt;int?&gt;(p, &quot;Id&quot;) != null &amp;&amp; object.Equals(
  objA: (object)EF.Property&lt;int?&gt;(p, &quot;Id&quot;),
  objB: (object)EF.Property&lt;int?&gt;(p0, &quot;PersonuppgiftId&quot;)))
  .Any(p0 =&gt; p0.ProjektId == __ProjektId_0))
  .OrderBy(p =&gt; p.Namn)' could not be translated. Additional information: Translation of member 'Namn' on entity type
  'Personuppgift' failed. This commonly occurs when the specified member
  is unmapped.</p>
  </blockquote>
  <p>My ApplicationDbContext is transient because of thread-conlicts.</p>
  <pre><code>builder.Services.AddDbContext&lt;ApplicationDbContext&gt;(options =&gt;
  {
      options.UseSqlServer(builder.Configuration.GetConnectionString(&quot;DefaultConnection&quot;));
  }, ServiceLifetime.Transient);
  </code></pre>